Crashing iOS app after creating a new view

0

I'm just starting to learn creating iOS apps and so I'm just a noob in it. Especially because of the different approach it has on handling navigation and interaction between UI and Code. :)

Ok I'm using xCode 5 with SDK version 7. I created a single view application and it gave me a .storyboard file which I guess replaces the .xib which used to be there when I watch tutorial videos.

So I designed a simple UI as the main view and now I want to have another view as the landing view. So it should come in before the main view. I went ahead and from New File... I created an Objective-C class which is a subclass of UIViewController and named it Detail. Surprisingly it gave me a .xib file again. Fair enough. Then I just put a simple input in the UI to just preview it.

Then from Project Settings, in the General tab, I changed the Main Interface to match the new .xib file I created. But when I launched the application, it crashed and I don't know what the problem is.

Here is the stack trace:

2013-11-27 18:31:21.735 TestViewSwitching[10123:70b] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<UIApplication 0x8b35dc0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key view.'
*** First throw call stack:
(
    0   CoreFoundation                      0x0174c5e4 __exceptionPreprocess + 180
    1   libobjc.A.dylib                     0x014bb8b6 objc_exception_throw + 44
    2   CoreFoundation                      0x017dc6a1 -[NSException raise] + 17
    3   Foundation                          0x0117c9ee -[NSObject(NSKeyValueCoding) setValue:forUndefinedKey:] + 282
    4   Foundation                          0x010e8cfb _NSSetUsingKeyValueSetter + 88
    5   Foundation                          0x010e8253 -[NSObject(NSKeyValueCoding) setValue:forKey:] + 267
    6   Foundation                          0x0114a70a -[NSObject(NSKeyValueCoding) setValue:forKeyPath:] + 412
    7   UIKit                               0x004cba15 -[UIRuntimeOutletConnection connect] + 106
    8   libobjc.A.dylib                     0x014cd7d2 -[NSObject performSelector:] + 62
    9   CoreFoundation                      0x01747b6a -[NSArray makeObjectsPerformSelector:] + 314
    10  UIKit                               0x004ca56e -[UINib instantiateWithOwner:options:] + 1417
    11  UIKit                               0x004cc2fb -[NSBundle(UINSBundleAdditions) loadNibNamed:owner:options:] + 165
    12  UIKit                               0x002293bb -[UIApplication _loadMainNibFileNamed:bundle:] + 58
    13  UIKit                               0x002296e9 -[UIApplication _loadMainInterfaceFile] + 245
    14  UIKit                               0x0022828f -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 543
    15  UIKit                               0x0023c87c -[UIApplication handleEvent:withNewEvent:] + 3447
    16  UIKit                               0x0023cde9 -[UIApplication sendEvent:] + 85
    17  UIKit                               0x0022a025 _UIApplicationHandleEvent + 736
    18  GraphicsServices                    0x036df2f6 _PurpleEventCallback + 776
    19  GraphicsServices                    0x036dee01 PurpleEventCallback + 46
    20  CoreFoundation                      0x016c7d65 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 53
    21  CoreFoundation                      0x016c7a9b __CFRunLoopDoSource1 + 523
    22  CoreFoundation                      0x016f277c __CFRunLoopRun + 2156
    23  CoreFoundation                      0x016f1ac3 CFRunLoopRunSpecific + 467
    24  CoreFoundation                      0x016f18db CFRunLoopRunInMode + 123
    25  UIKit                               0x00227add -[UIApplication _run] + 840
    26  UIKit                               0x00229d3b UIApplicationMain + 1225
    27  TestViewSwitching                   0x0000211d main + 141
    28  libdyld.dylib                       0x01d7670d start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException

This process in Android is pretty straight forward, but I don't know why Apple tries to make everything harder for developers. They couldn't just set up a type which generates a new view ready to go?

ios
iphone
objective-c
xcode

2 Answers

3

@Miro Markarian , you may check the .xib file for view outlet.It may be be disconnected or broken.This issue generally arises due to that.Try to add the outlet of the view controller's view to the .xib view.

answered on Stack Overflow Nov 28, 2013 by Himanshu Gupta
0

Your view outlet on your main view controller's .xib is not connected to its file owner properly.

answered on Stack Overflow Nov 28, 2013 by thatzprem

User contributions licensed under CC BY-SA 3.0