views:

609

answers:

6

Hi!
I started a project in xcode (3.2 on snow leopard) with base sdk 3.1.2. Now I changed this setting to 3.0 and it compiles without a warning. There are no problems running the app on the device, but the simulator crashes on launch every time with the following exception:

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '[NSKeyedUnarchiver initForReadingWithData:]: incomprehensible archive (0x4e, 0x49, 0x42, 0x41, 0x72, 0x63, 0x68, 0x69)'

I do not use the NSKeyedUnarchiver, so why is the app trying to call it? And what archive is incomprehensible? I reset the simulator before building, so there are no userDefaults or anything else around.
Thanks for your help!

A: 

Hi,

Try uninstalling your app completely from the simulator - it might be storing some data somewhere to do with the settings?

Do you have a stack trace from the debugger showing where the call to NSKeyedUnarchiver is coming from?

S

deanWombourne
Resetting the simulator or uninstalling the app does not help. And i was wrong: On a 3.0 device the same exception occurs. But there is no Problem with the same build on a device with 3.1.2. The stack trace: ... #4 in -[NSKeyedUnarchiver initForReadingWithData:], #5 in -[UINib instantiateWithOptions:owner:loadingResourcesFromBundle:], #6 in -[NSBundle(NSBundleAdditions) loadNibNamed:owner:options:], #7 in -[UIApplication _loadMainNibFile], #8 in -[UIApplication _runWithURL:sourceBundleID:] ...
Florian
+1  A: 

I solved the problem with this detailed stack trace:

#0  0x302ac924 in ___TERMINATING_DUE_TO_UNCAUGHT_EXCEPTION___  
#1  0x904a3509 in objc_exception_throw  
#2  0x3028e5fb in +[NSException raise:format:arguments:]  
#3  0x3028e55a in +[NSException raise:format:]  
#4  0x30513b77 in -[NSKeyedUnarchiver initForReadingWithData:]  
#5  0x30ab4b2a in -[UINib instantiateWithOptions:owner:loadingResourcesFromBundle:]  
#6  0x30ab6eb3 in -[NSBundle(NSBundleAdditions) loadNibNamed:owner:options:]  
#7  0x308f85f1 in -[UIApplication _loadMainNibFile]  
#8  0x30901a15 in -[UIApplication _runWithURL:sourceBundleID:]  
#9  0x308fef33 in -[UIApplication handleEvent:withNewEvent:]  
#10 0x308fad82 in -[UIApplication sendEvent:]  
#11 0x309013e1 in _UIApplicationHandleEvent  
#12 0x32046375 in PurpleEventCallback  
#13 0x30245560 in CFRunLoopRunSpecific  
#14 0x30244628 in CFRunLoopRunInMode  
#15 0x308f930d in -[UIApplication _run]  
#16 0x309021ee in UIApplicationMain  
#17 0x0000255c in main at main.m:14  

The app crashes while calling the mainNibFile. And I don't know why, but simply re-saving the MainWindow.xib solved the problem.

Florian
A: 

I had the same problem. The opening and re-saving of MainWindow.xib solved the problem for me as well.

pirey4
A: 

Thanks Florian,

That's a completely bizarre fix but it worked for me also :D

First step, my red triangle. Next step, my first completed 3D OpenGL game :D

ROFL!

Thanks!

Fogmeister
A: 

I had the same problem, and deleting the app from simulator and running again helped.

msk
A: 

I had the same problem, deleted the app from simulator and removed the builds totally from build folder of the project. Rebuild the app, it worked.

jimmy