Xcode 5 defaults to storyboard, no XIB file


#1

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!


#2

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.


#3

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? :wink:


#4

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


#5

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:

[code]@implementation WhereamiViewController

  • (void)viewDidLoad
    {
    if (self)
    {
    // 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
    }
    [/code]

As soon as I figured this out, it ran perfectly in the Simulator.


#6

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.


#7

Hi All !

First of all, excuse my english, I’m a bit too frenchy for perfect language :slight_smile:

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.

[code]- (void)viewDidLoad
{
[super viewDidLoad];
// création du gérant de géolocalisation
locationManager = [[CLLocationManager alloc] init];
//demandons la précisions maximale
[locationManager setDesiredAccuracy:kCLLocationAccuracyBest];

// Attention c'est temporaire
[locationManager setDelegate:self];


// Lançons immédiatement la géolocalisation
[locationManager startUpdatingLocation];

}
[/code]

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.


#8

The viewDidLoad is the secret! Thanks!


#9

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!

Thanks


#10

[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!
Thanks[/quote]

If you are eligible, I´d try, because the 4th edition finally has a fixed release date.

http://www.amazon.com/iOS-Programming-Ranch-Edition-Guides/dp/0321942051

Publisher: Big Nerd Ranch Guides; 4 edition (February 20, 2014)
Language: English
ISBN-10: 0321942051
ISBN-13: 978-0321942050


#11

To solve this problem, you do:

  1. 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
  2. Write all code from book in 1 chapter
  3. Build and run. You may get “Application windows are expected to have a root view controller at the end of application launch” error.
  4. Download solution for this book, open example for this chapter and find in BNRAppDelegate .m and .h for missing lines of code.
  5. Write in your AppDelegate .m and .h missing lines of code.

I performed this steps and the application was successfully run =)


#12

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.