iPhone Simulator chrashes in NSKeyedUnarchiver after setting base SDK
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, 0x4开发者_StackOverflow中文版1, 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.
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.
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
I had the very same kind of problem, after
- sending my Xcode project on an FTP remote server (with FileZilla)
- re-downloading
- and launching it to check if the file passed well. The re-downloaded file had this problem.
I think the ftp makes problems with bundle files (such as .xcodeproj) because sometimes, .pages and .numbers files have problems too.
I solved the problem by
- compressing my project (.zip)
- uploading the .zip on the ftp.
- re-downloading
- unzipping it
- when launched, no more problem !
精彩评论