Using Xcode 4.6.1 and 2nd Edition of Book


I’m working from a copy of the iOS Programming: The Big Nerd Ranch Guide 2nd Edition ©2011. It seems like Apple must have made some changes to Xcode since then.

I’m running Xcode 4.6.1 on Mac OS X 10.8.3

The first difference was that there is no template for Window-based Application. So I used the template for Single-View Application. (I also tried Empty Application, it it didn’t create a .xib file)

This creates additional files in addition to BNRAppDelegate files,

The way you hook up connections in Interface Builder appears to be different than the 2nd ed. book. For one thing, BNRAppDelegate does not appear in the Outline/Dock. Also, I couldn’t make connections to IBOutlets if they were in BNRAppDelegate.

So I just did all the editing in View Controller and didn’t edit BNRAppDelegate.h or BNRAppDelegate.m at all

I got Quiz working :sunglasses: , but had to deviate from the book somewhat.


Another thing I had to do different from the 2nd Ed book.

The init method in BNRViewController.m is never called. So I put the code that loads the questions and answers arrays inside the viewDidLoad method.

[code]@implementation BNRViewController

  • (void)viewDidLoad
    NSLog(@“BNRViewController: viewDidLoad”);
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    if (self) {
    // Create two arrays and make pointers to them
    questions = [[NSMutableArray alloc] init];
    answers = [[NSMutableArray alloc] init];
    // Add some questions and answers to the arrays
    [questions addObject:@“What is 7+7?”];
    [answers addObject:@“14”];
    [questions addObject:@“What is das capital of Vermont?”];
    [answers addObject:@“Montpelier”];
    [questions addObject:@“From what is cognac made”];
    [answers addObject:@“fermented grapes”];

Note: I added NSLog’s at top of methods to see when they are called. I find this is useful for debugging.