Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialTal Zion
6,234 PointsAuto code completion not working NSURL etc..
Hi,
My code completion does not work for NS Objects. When I type N, it suggests from null - numerciCast(x:T)... only 7 suggestions.
All the Code completion check boxes in the preferences are ticked and I am using Xcode 6.1. Am I missing something?
Thanks
3 Answers
Paul Gergely
2,888 PointsIt's a bug, I'm having the same issue. Exit Xcode and delete Derived Data folder here:
~/Library/Developer/Xcode
Then restart Xcode and you should see the autocomplete working again. This solved it for me. Hope it helps.
I also found another answer saying that you only have to delete the ModuleCache folder but didn't try this. I deleted the whole derived data folder.
Michael Hulet
47,913 PointsMake sure you're not just import
ing UIKit
, but Foundation
, too. Somewhere close to the top of your file should look like this:
import UIKit
import Foundation
Aurelian Spodarec
7,369 PointsHi, so i think i may have the same problem? or it may be relevant to this topic but what my problem is when i make a class or object not sure : p the coca thingy , like in catspace and when i create NSNode , or something like that , it never suggests me anything . but if i go to the file from treehouse ,
If create a new file every time, it always work so basically it never works when i want to create my project from 100% . Its coz before there was an MyScene.h /m and now they deleted it and i can't get i back and code like i should . It never ever suggests me when i start with NS.. i tried everything but nothing works.
Do you know what may be the problem or what should i do?
Tal Zion
6,234 PointsHi Aurelian, I received an answer from Paul Gergely, fixing a bug with XCODE. Please see answer below:
It's a bug, I'm having the same issue. Exit Xcode and delete Derived Data folder here:
~/Library/Developer/Xcode
Then restart Xcode and you should see the autocomplete working again. This solved it for me. Hope it helps.
I also found another answer saying that you only have to delete the ModuleCache folder but didn't try this. I deleted the whole derived data folder.
Tal Zion
6,234 PointsThanks for you help Michael. I tried it but unfortunately I don't see any change. Had a look at the tutorial for this lesson, I didn't see the Foundation was imported in this case. Had a look and code is identical. Would you know what might be the problem? It does autocomplete more general code, such as variable etc.. This is my code so far, had this problem also in the Building My First App Course, but kind of got use to it as there was not complicated implementation such as the NSURLSessionDownloadTask.
This is my code (by the way, all works fine, just doesn't auto complete):
// // ViewController.swift // Strom // // Created on 05/11/2014. // Copyright (c). All rights reserved. //
import UIKit
class ViewController: UIViewController {
private let apiKey = "0313a99f3578b7890a359e87732c9353"
override func viewDidLoad() {
super.viewDidLoad()
let baseURL = NSURL(string: "https://api.forecast.io/forecast/\(apiKey)/")
let forecastURL = NSURL(string: "37.8267,-122.423", relativeToURL: baseURL)
let sharedSession = NSURLSession.sharedSession()
let downloadTask: NSURLSessionDownloadTask = sharedSession.downloadTaskWithURL(forecastURL, completionHandler: { (location: NSURL!, response: NSURLResponse!, error: NSError!) -> Void in println(response)
})
downloadTask
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
Tal Zion
6,234 PointsTal Zion
6,234 PointsThanks Paul!!! Wow, I spent so long looking at forums trying to figure out an answer and no one could provide one. I deleted the ModuleCache folder and finally all works fine.
Thanks so much.. :)
Jeff Aldrich
1,429 PointsJeff Aldrich
1,429 PointsI don't seem to have this folder in my Library, and nothing comes up when I search for "Developer" or "ModuleCache"...
Nawfal Uchiwa
4,315 PointsNawfal Uchiwa
4,315 PointsIt works, thank you dude !
Aurelian Spodarec
7,369 PointsAurelian Spodarec
7,369 PointsI don't have it , its not there, who can i do it?
http://scr.hu/2icp/6kg7b