Xcode 5 (still in preview at the time of posting) doesn’t have a checkbox for storyboard when creating a new project. It defaults to storyboard and there is no XIB file. How to adjust? Thanks!
Just starting out myself and noticing a bunch of differences. I believe the reason for no XIB file is due to Apple forcing the usage of auto layout and thus defaulting to storyboard. I could be wrong, as I’m pretty new to all this, but judging by the wwdc session videos, that’s the vibe I got.
I’m assuming you’re running into the same issue I’m having where the arrays aren’t being populated and read this post viewtopic.php?f=212&t=5646 telling you to uncheck storyboard?
Also having this problem. I tried making an empty application and then adding a new Objective-C class (where the “With XIB for User Interface” option is present). But now I’m getting an exception.
Screenshot 1: http://s12.postimg.org/oxxqzabr1/Screen_Shot_2013_09_15_at_8_07_54_PM.png
Screenshot 2: http://s8.postimg.org/5b6yt3bid/Screen_Shot_2013_09_15_at_7_47_49_PM.png
Project File: filedropper.com/quiz_1
In this first exercise, the init code calls the nib file, which doesn’t exist in Xcode5 (unless you add it manually). So you need to get rid of the initWithNibName code. Here is what your partial code should look like:
// Create two arrays and make the pointers point to them
questions = [[NSMutableArray alloc] init];
answers = [[NSMutableArray alloc] init];
// Add questions and answers to the array [questions addObject:@"What is 7 + 7?"]; [answers addObject:@"14"]; [questions addObject:@"What is the capital of Vermont?"]; [answers addObject:@"Montpelier"]; [questions addObject:@"What is cognac made from?"]; [answers addObject:@"Grapes"];
// Be sure to delete the return as well
As soon as I figured this out, it ran perfectly in the Simulator.
Thanks Gary for your timely advice. I’m an 80 y.o. new comer to IOS and initially completed this exercise using Xcode 4.6 SDK 6.2. I then upgraded to Xcode 5 SDK 7.0 and tried the same exercise again. I then had to learn how to use storyboard and now you have solved the problem I had trying to use the initWithNibname code. After following your advice, all works fine now. I suppose there will be other exercises in this book where similar problems will arise because of the Xcode upgrade and I hope good people like yourself will be able to answer them.
Hi All !
First of all, excuse my english, I’m a bit too frenchy for perfect language
After Many many tries with the “single view application” it’s a big pain to get rid of the storyboard.
Even with the manual implementation of a Xib file, it will simple doesn’t work at all.
Suppression of the storyboard leads to an exception.
By the way the correct way seems effectively to use the viewDidLoad method.
// création du gérant de géolocalisation
locationManager = [[CLLocationManager alloc] init];
//demandons la précisions maximale
// Attention c'est temporaire [locationManager setDelegate:self]; // Lançons immédiatement la géolocalisation [locationManager startUpdatingLocation];
My question is … is the [super viewDidLoad] useful ?
I hope that i’ll manage to change the rest of the code simply.
Thanks all et salut aux francais.
The viewDidLoad is the secret! Thanks!
I’m lost with following the fix for not having the XIB file! Can someone provide a bit more guidance, such as possible the book’s authors, as this appears to be a major gap for many who are new to IOS and can’t get any momentum going…
If not, I will be requesting a refund from Amazon on the book as it will be useless to me with IOS 7!
[quote=“g2sleeper”]If not, I will be requesting a refund from Amazon on the book as it will be useless to me with IOS 7!
If you are eligible, I´d try, because the 4th edition finally has a fixed release date.
Publisher: Big Nerd Ranch Guides; 4 edition (February 20, 2014)
To solve this problem, you do:
- Create new Empty project and and then adding a new Objective-C class as subclass of UIViewController (where the “With XIB for User Interface” option is present), as wrote @colindunn
- Write all code from book in 1 chapter
- Build and run. You may get “Application windows are expected to have a root view controller at the end of application launch” error.
- Download solution for this book, open example for this chapter and find in BNRAppDelegate .m and .h for missing lines of code.
- Write in your AppDelegate .m and .h missing lines of code.
I performed this steps and the application was successfully run =)
I found that just using an older version of Xcode solves this problem for me. Version 4.6 works with OSX Mavericks and can be used to follow the examples in the book without changing them. Then to push the app to an iOS device, just use a newer version of Xcode to open the project and handle the device stuff.