Just thought I'd share my solution to this NSKeyedUnarchiver incomprehensible archive xib error.
I've just spent a couple of weeks pulling my hair out on this, and my workaround is pretty much the same as borrrden's, above (i.e. use nib files built with an old version of Xcode). I tried everything else I could think of without any joy. (My other choices were to stop using xib file and write the entire UI in code or to stop supporting iOS 3.0)
So, here is my situation, how I got the workaround to work and how I went about building a Distribution Archive for the app store.
First a wee bit of background: My app was originally built with Xcode 3.2.5 and worked fine on iOS 3.0 and above. When I upgraded to Xcode 4.2 I got the NSKeyedUnarchiver error as soon as the app loaded a xib file. After a bit of Googling I came across the other articles mentioned in this thread, so I changed the Deployment and Development versioning on each xib file. This worked a treat, until I upgraded to Xcode 4.3.1 when the error returned. I re-checked all the xib files but no joy. Even though they were set for iOS3.0/IB3.0 (and I tried every combination available), the app still crashed.
In an attempt to prove this was a problem with the xib files I tried debugging on device (a 2nd generation iPod Touch running iOS 3.0, attached to Xcode by cable). But the app would crash before the debugger could get going. So I removed MainWindow.xib from the project (setting the App Delegate and UIWindow up in code). This allowed the debugger to get started and hit my first breakpoint (the first line of application:didFinishLaunchingWithOptions), but the app would just hang without throwing an exception as soon I pushed a ViewController. After much digging I switched the debugger from LLDB to GDB (from Products -> Edit Scheme). This stopped the app from hanging and threw the exception as I expected it should (the incomprehensible archive one). LLDB obviously still has issues.
After a couple of weeks of pulling my hair out the only thing that worked was to use nib files built with an old version of Xcode. Luckily I still have Xcode 3.2.5 sitting on my machine. Here are the steps I used to get this working, and to allow an Archive to be built for the app store:
- Quit Xcode 4.3.1 and start Xcode 3.2.5.
- Create a new View-Based-Application project and add all the .xib files from your main project into it.
- Set deployment target to iOS3.0 then do a Release Build and Run on device (use your generic provisioning profile if it doesn't pick this up automatically)
- From Xcode, Reveal the .app in finder, then Show Package Contents to see all the .nib files within it (Xcode has converted the .xib files into .nib files).
- For ease of use, copy the .nib files to another directory.
- Quit Xcode 3.2.5 and start Xcode 4.3.1 and open your project.
- Visit each xib and from the sidebar on the right deselect your app from the Target Membership (this means Xcode will not use these .xib files for the final package).
- Now add all the new .nib files (as generated by Xcode 3.2.5) to your project (for neatness put them in a Group of their own).
- Now you can Clean, Build and Run as much as you like and even build an Archive for the app store.
To prove the correct .nib files are being used, use md5 from the Terminal. Show your .app (or the Archive from Organiser) in Finder to see where Xcode created it then Show Package Contents to see the .nib files. Compare the md5 checksums with those from the .nib files created by Xcode 3.2.5.
Just remember that any time you modify a xib it wont get used until you build from Xcode 3.2.5. and copy the resulting .nib file to your holding directory.
This isn't ideal and if anyone has a better solution that works I'll be keen to hear it. In the meantime I hope this helps.