Chapter 1 Problem


I am trying to get through the first simple app and I have the latest xCode. My problem is that the book asks me to open the AppDelegate. With the new xcode this is called AppDelegate.swift and the code is different. What do I change to make sure that I have the right #imports and still have the App run correctly?

This is the code I get when clicking on the AppDelegate.swift file. It’s nothing like what the book says it should be. Any ideas? Please? :smiley:

import UIKit

class AppDelegate: UIResponder, UIApplicationDelegate {

@property (nonatomic, weak) IBOutlet UILabel *questionLabel;



It looks like Xcode is using Swift as the default language; change the language to Objective-C.

By the way, it would be much easier for you to follow the book if you used the version of Xcode (5.0) for which the book was written. Also, don’t jump into Swift without learning Objective-C first.

[Become a competent programmer faster than you can imagine:]


I agree, but when my computers were updated by my IT department, it updated to the latest xCode. It seems like xCode really likes to be updated and starts to have problems here and there until it is updated.


I have check and the default source is Objective C no Swift. Any other ideas? I feel like I’m missing something basic. I’ve even inserted code to load a Root View Controller but it defaults to UIViewController and then gives me an error that that isn’t in my program. When I change it to the name of my view controller it errors on me again. Any other ideas?


What do you mean “default source”? Where is this setting?

The only way you would have AppDelegate.swift in a new project is if you selected Swift as the language when creating the project.

My best suggestion is to start fresh with a new project, being certain that Objective-C is selected as the language in the dialog box shown after selecting the project type.

Also, be sure to check out Christian Keur’s post on using Xcode 6 with the book. (I assume you’re using Xcode 6. You said you have “the latest,” but it’s helpful to be explicit.)