iPhone – After upgrading the iOS application crash

See answer in English> What does this mean? “’NSUnknownKeyException’, reason:… this class is not key value coding-compliant for the key X” 66 if I run With a clean build and a fresh installation, my application installs and runs just fine, but if I install the previously released version and then overwrite that version with the new version, it will crash on the first run.

p>

Steps to reproduce

>Install and run the previous version (1.4) of my application on iPhone 4.
>Close the application and kill the process.
>End The latest version (2.0)
>Delete the build directory
>Install and run
>Crash

I am running Xcode 3.2.5, 4.2 SDK. My iPhone 4 is 4.2. 1.

If you look at the crash log, it looks like the connection in one of my NIBs is incorrect, but no object is trying to connect to the’view’ property in my AppController. The same crash sometimes occurs, Unless it will say that this class is not compatible with the key-value encoding of the key-value activity indicator. This is also bad, because grep has confirmed that my project is called activityIndicator and I have nothing.

I There are three questions:

>Why does my application crash?
>Does anyone have any ideas on further debugging I can do? I have completed the idea of ​​how to solve this problem.
>It is possible (maybe?) when Xcode installs the build on your device, it requires a shortcut that will not be taken when installing the app from the store. Does anyone know Is this the case, and if so, do you know a way to simulate the exact app store installation process, so I can make sure that I haven’t killed all my upgraded apps?

Crash log

2011-02-10 06:58:32.115 TheApp[132:307] *** Terminating app due to uncaught exception'NSUnknownKeyException ', reason:'[ setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key view.'
*** Call stack at first throw:
(< br /> 0 CoreFoundation 0x33ac0987 __exceptionPreprocess + 114
1 libobjc.A.dylib 0x3347b49d objc_exception_throw + 24
2 CoreFoundation 0x33ac0705 -[NSException dealloc] + 0
3 Foundation 0x3367db4f -[NSKeyValueCodingObject)(NSKeyValue) setValue:forUndefinedKey:] + 182
4 Foundation 0x3367d03b _NSSetUsingKeyValueSetter + 90
5 Foundation 0x3367eda3 -[NSObject(NSKeyValueCoding) setValue:forKey:] + 194
6 Foundation 0x33630b17 -[NSObject(NSKeyValueCoding) setValue:f orKeyPath:] + 130
7 UIKit 0x3224c60f -[UIRuntimeOutletConnection connect] + 66
8 CoreFoundation 0x33a63fc7 -[NSObject(NSObject) performSelector:] + 18
9 CoreFoundation 0x33a6cd51 -[NSArray makeObjectsPerformSelector:] + 388
10 UIKit 0x3224b577 -[UINib instantiateWithOwner:options:] + 586
11 UIKit 0x3224cb39 -[NSBundle(UINSBundleAdditions) loadNibNamed:owner:options:] + 92
12 UIKit 0x3209e871 -[ UIApplication _loadMainNibFile] + 96
13 UIKit 0x3209a1fd -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 180
14 UIKit 0x3206648b -[UIApplication handleEvent:withNewEvent:] + 1114
15 UIKit 0x32065ec9 -[UIApplication se ndEvent:] + 44
16 UIKit 0x32065907 _UIApplicationHandleEvent + 5090
17 GraphicsServices 0x33b0ef03 PurpleEventCallback + 666
18 CoreFoundation 0x33a556ff __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_TO_A_SOURCE1_PERFORM_Fx/>166SourceFoundation 20 UNCTION__ + 26SourceFoundation 0 CF33166
20 UNCTION__ + 26. CoreFoundation 0x33a47f7d __CFRunLoopRun + 520
21 CoreFoundation 0x33a47c87 CFRunLoopRunSpecific + 230
22 CoreFoundation 0x33a47b8f CFRunLoopRunInMode + 58
23 UIKit 0x32099309 -[UIApplication _run/> 2493 UIKit 0x32096] + 380 UIKit 0x32096 br /> 25 TheApp 0x00002781 main + 88
26 TheApp 0x00002724 start + 40
)

Me It should be added that the application crashes before entering any of my code, namely application: didFinishLaunchingWithOptions: and applicationDidFinishLaunching: will never be called.

I finally figured out the problem. The previous version of my application was not localized, so all NIBs are at the top level of the application package. The latest version of my application is localized , So all NIBs are located in the en.lproj directory. When Xcode deploys the application to the device (and simulator), it does not replace the entire package, it just copies the build files into the existing package. This leads to my Two versions of NIB, the outdated version at the top of my application package and the current version in the subfolders.

When setting up the application, it will pull the top NIB, which is incorrect The NIB caused a crash. Therefore, I need to actually deploy the .ipa to my phone to test the upgrade.

See the English answer> What does this mean? “‘ NSUnknownKeyException’, reason:… this class is not key value coding-compliant for the key X” 66 of them
If I run a clean build and a brand new installation, my app installs and runs well, but if I install the previously released version, and then overwrite the version with the new version, it will crash the first time it runs.

Steps to reproduce

>Install and Run the previous version of my application (1.4).
>Close the application and kill the process.
>Checkout the latest version (2.0)
>Delete the build directory
>Install and run
>Crash

I am running Xcode 3.2.5, 4.2 SDK. My iPhone 4 is 4.2.1.

If you check the crash log, it looks like one of my NIBs The connection is incorrect, but no object tries to connect to the’view’ property in my AppController. Sometimes the same crash occurs, unless it will say that this class is not compatible with the key-value encoding of the key-value activity indicator. This is also bad Because grep has confirmed that my project is called activityIndicator, and I have nothing. /p>

I have three questions:

>Why does my application crash?
>Does anyone have any ideas on further debugging I can do? I have completed the idea of ​​how to solve this problem.
>It is possible (maybe?) when Xcode installs the build on your device, it requires a shortcut that will not be taken when installing the app from the store. Does anyone know Is this the case, and if so, do you know a way to simulate the exact app store installation process, so I can make sure that I haven’t killed all my upgraded apps?

Crash log

2011-02-10 06:58:32.115 TheApp[132:307] *** Terminating app due to uncaught exception'NSUnknownKeyException ', reason:'[ setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key view.'
*** Call stack at first throw:
(< br /> 0 CoreFoundation 0x33ac0987 __exceptionPreprocess + 114
1 libobjc.A.dylib 0x3347b49d objc_exception_throw + 24
2 CoreFoundation 0x33ac0705 -[NSException dealloc] + 0
3 Foundation 0x3367db4f -[NSKeyValueCodingObject)(NSKeyValue) setValue:forUndefinedKey:] + 182
4 Foundation 0x3367d03b _NSSetUsingKeyValueSetter + 90
5 Foundation 0x3367eda3 -[NSObject(NSKeyValueCoding) setValue:forKey:] + 194
6 Foundation 0x33630b17 -[NSObject(NSKeyValueCoding) setValue:forK eyPath:] + 130
7 UIKit 0x3224c60f -[UIRuntimeOutletConnection connect] + 66
8 CoreFoundation 0x33a63fc7 -[NSObject(NSObject) performSelector:] + 18
9 CoreFoundation 0x33a6cd51 -[NSArray makeObjectsPerformSelector:] + 388
10 UIKit 0x3224b577 -[UINib instantiateWithOwner:options:] + 586
11 UIKit 0x3224cb39 -[NSBundle(UINSBundleAdditions) loadNibNamed:owner:options:] + 92
12 UIKit 0x3209e871 -[ UIApplication _loadMainNibFile] + 96
13 UIKit 0x3209a1fd -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 180
14 UIKit 0x3206648b -[UIApplication handleEvent:withNewEvent:] + 1114
15 UIKit 0x32065ec9 -[UIApplication sendE vent:] + 44
16 UIKit 0x32065907 _UIApplicationHandleEvent + 5090
17 GraphicsServices 0x33b0ef03 PurpleEventCallback + 666
18 CoreFoundation 0x33a556ff __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_Fx/> 19556SourceFoundation __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_Fx/> 19556SourceFoundation + 26. CoreFoundation 0x33a47f7d __CFRunLoopRun + 520
21 CoreFoundation 0x33a47c87 CFRunLoopRunSpecific + 230
22 CoreFoundation 0x33a47b8f CFRunLoopRunInMode + 58
23 UIKit 0x32099309 -[UIApplication _run/> 2493 UIKit 0x32096] + 380 UIKit 0x32096 br /> 25 TheApp 0x00002781 main + 88
26 TheApp 0x00002724 start + 40
)

I should add one Point, the application crashes before entering any of my code, that is, application: didFinishLaunchingWithOptions: and applicationDidFinishLaunching: will never be called.

I finally figured it out The problem is. The previous version of my app is not localized, so all NIBs are at the top level of the app package. The latest version of my app is localized, so all NIBs are in the en.lproj directory. When Xcode When deploying the app to the device (and emulator), it does not replace the entire package, it just copies the build files into the existing package. This causes two versions of my NIB, the top level of my app package to be obsolete Version and the current version in the subfolder.

When setting up the application, it will pull the topmost NIB, which is an incorrect NIB, causing a crash. Therefore, I need to actually add the .ipa Deploy to my phone to test the upgrade.

Leave a Comment

Your email address will not be published.