Exception when running Localizing Resources code


Am running iOS4.1 and I’ve added “Spanish” as a localization and edited the NIB. Switched the iPhone to Spanish and rebooted. Did the Build > Clean step and even deleted the app from the iPhone but I still get this error on running the app:

2010-10-05 17:19:36.751 Homepwner[113:307] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not load NIB in bundle: 'NSBundle </var/mobile/Applications/5956A439-7615-4C05-A9DE-731E39614FE4/Homepwner.app> (loaded)' with name 'MainWindow''

This seems to indicate that the problem is with MainWindow.xib and I notice there’s only 1 localization of that which is named “en”. Is that OK?


Curiously if I roll back to an earlier version of Homepwner (before making any changes specified in this chapter) I get the same exemption when the iPhone is in Spanish.


Did you localize MainWindow.xib by accident? You don’t want any localizations for that one, it’s just a blank window.


Thanks Joe, I’ve eventually managed to fix it. From memory I think I started this project in Xcode 4 then moved back to 3.2.4. There was an “en.lproj” folder (created by default?) which contained InfoPlist.strings and MainWindow.xib. Inside my Classes folder were English.lproj and Spanish.lproj folders. So I moved the contents of en.lproj into the root of the project folder (reimported them into Xcode) and deleted the en.lproj folder. The app now runs without the exception after this.