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 trial

iOS Build a Weather App with Swift (Retired) Concurrency Writing Concurrent Networking Code

Tal Zion
Tal Zion
6,234 Points

Auto 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

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
Tal Zion
6,234 Points

Thanks 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.. :)

I don't seem to have this folder in my Library, and nothing comes up when I search for "Developer" or "ModuleCache"...

Nawfal Uchiwa
Nawfal Uchiwa
4,315 Points

It works, thank you dude !

I don't have it , its not there, who can i do it?

http://scr.hu/2icp/6kg7b

Michael Hulet
Michael Hulet
47,913 Points

Make sure you're not just importing UIKit, but Foundation, too. Somewhere close to the top of your file should look like this:

import UIKit
import Foundation

Hi, 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
Tal Zion
6,234 Points

Hi 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
Tal Zion
6,234 Points

Thanks 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.
}

}