Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

RonC

macrumors regular
Original poster
Oct 18, 2007
108
0
Chicago-area
I downloaded Xcode 4.2 recently and created a new project. I've built stuff using previous versions of Xcode without too much difficulty, but I'm completely lost and need a little guidance.

I want a little app that has a single view, with a couple of buttons and labels and regular old UI stuff. I knew how to put this together until Xcode 4.2.

First, I didn't recognize any of the templates. Is there a good template for a TableView app?

Because I didn't recognize any of the templates, I chose the "Single View Application" template.
Second, WTF is a Storyboard and why would I want to use that? I want my .xibs, dammit.

I managed to convince it to create a .xib by unchecking the storyboard box. I also turned off ARC, because I don't understand that either.​

Finally, this project, straight out of the box, doesn't actually run! Here's what I get:
Code:
2011-11-03 18:42:09.998 eMoocher[15560:207] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<UIApplication 0x4b1a9f0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key view.'
*** Call stack at first throw:
(
	0   CoreFoundation                      0x00fb8be9 __exceptionPreprocess + 185
	1   libobjc.A.dylib                     0x0110d5c2 objc_exception_throw + 47
	2   CoreFoundation                      0x00fb8b21 -[NSException raise] + 17
	3   Foundation                          0x007796cf _NSSetUsingKeyValueSetter + 135
	4   Foundation                          0x0077963d -[NSObject(NSKeyValueCoding) setValue:forKey:] + 285
	5   UIKit                               0x002098d6 -[UIRuntimeOutletConnection connect] + 112
	6   CoreFoundation                      0x00f2f2cf -[NSArray makeObjectsPerformSelector:] + 239
	7   UIKit                               0x002082ed -[UINib instantiateWithOwner:options:] + 1041
	8   UIKit                               0x0020a081 -[NSBundle(UINSBundleAdditions) loadNibNamed:owner:options:] + 168
	9   UIKit                               0x00014943 -[UIApplication _loadMainNibFile] + 172
	10  UIKit                               0x000154ca -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 291
	11  UIKit                               0x0001fdb2 -[UIApplication handleEvent:withNewEvent:] + 1533
	12  UIKit                               0x00018202 -[UIApplication sendEvent:] + 71
	13  UIKit                               0x0001d732 _UIApplicationHandleEvent + 7576
	14  GraphicsServices                    0x00cbca36 PurpleEventCallback + 1550
	15  CoreFoundation                      0x00f9a064 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
	16  CoreFoundation                      0x00efa6f7 __CFRunLoopDoSource1 + 215
	17  CoreFoundation                      0x00ef7983 __CFRunLoopRun + 979
	18  CoreFoundation                      0x00ef7240 CFRunLoopRunSpecific + 208
	19  CoreFoundation                      0x00ef7161 CFRunLoopRunInMode + 97
	20  UIKit                               0x00014fa8 -[UIApplication _run] + 636
	21  UIKit                               0x0002142e UIApplicationMain + 1160
	22  eMoocher                            0x00001d7d main + 125
	23  eMoocher                            0x00001cf5 start + 53
)

That points back to this code, in main.m:

Code:
int main(int argc, char *argv[])
{
    @autoreleasepool {
        return UIApplicationMain(argc, argv, nil, NSStringFromClass([EMAppDelegate class]));
    }
}

specifically, that return line.

So here I am, completely unable to even get started. Please help, at least to get me past this part.
 
Last edited:
Well, I'm having a bit of trouble and being a bit pissed about this as well, for 'once again', ruining what we already have.
What I did, is create an empty XIB (there is an option for Application Delegate at new File, User interface). Then at my Target, tell it, it has to use the MainWindow, and build from scratch there, add a view controller, or a plain view. Or whatever.
What you are trying to do from your crash log, it's trying to use a IBOutlet which it doesn't have.
 
What you are trying to do from your crash log, it's trying to use a IBOutlet which it doesn't have.

Yeah, I figured that was what it was, but doesn't UIViewController have the "view" outlet? InterfaceBuilder seems to think it does...

I'll give your way a go -- what the heck, it doesn't work now, so how much worse can it get...

Thanks for the help.
 
New Features in Xcode 4.2.

It might help to know which version of Xcode you're coming from.

Also, have you read anything regarding Xcode 4.2? I take it you didn't read the What's New in 4.2 document, or you wouldn't have asked what Storyboards are. So if you didn't read anything at all, not even release notes, then starting there might be good. For example, look under Xcode's Help menu.
 
Thanks for the pointer. Looks like I have some reading to do.

I was able to get it to go, so I'm at least able to do something until I finish reading.
 
I'd read up on Storyboard's before yelling WTF. They provide some really nice features and allow you to perform segues easily, reducing the amount of redundant code in your app.

Also, you can still use xibs even if you application uses storyboards. It's common to use storyboards for the main flow of your app and xibs when it's more convenient.
 
You said you are not using ARC but the code you show from main.m shows that you are.

I meant to turn it off, and I thought I did (by not checking the box that said "Use Automatic Reference Counting"); it's certainly possible that I checked it in error.

I'm still feeling my way around the new Xcode. I did a lot of work in Xcode 4.1.2 (? - the immediate prior version) and actually managed to ship an app or two - all internal enterprise or ad hoc distribution.

I was quite surprised by the changes in Xcode 4.2, so my reaction may be stronger than others who knowingly jumped in. I'll get it, I'm sure.

I do appreciate the helpful comments here, though.
 
I meant to turn it off, and I thought I did (by not checking the box that said "Use Automatic Reference Counting"); it's certainly possible that I checked it in error.

I'm still feeling my way around the new Xcode. I did a lot of work in Xcode 4.1.2 (? - the immediate prior version) and actually managed to ship an app or two - all internal enterprise or ad hoc distribution.

I was quite surprised by the changes in Xcode 4.2, so my reaction may be stronger than others who knowingly jumped in. I'll get it, I'm sure.

I do appreciate the helpful comments here, though.

Custom segue's kick ass. Storyboarding is odd at first but once you get the hang of it, you will come to love it more than individual nibs.
 
Storyboard supports iOS 5 only, from what I've read. I'd try starting a new project. (ARC might also require iOS 5.)

ARC means you don't have to worry about garbage collection IIRC.
 
Storyboard supports iOS 5 only, from what I've read. I'd try starting a new project. (ARC might also require iOS 5.)

ARC means you don't have to worry about garbage collection IIRC.

I do believe Arc is also supported with 4.3 and up. You will need to add the required values to your plist for storyboard support.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.