Cleaning after localizing DetailViewController kills app


#1

So, I am following the book to a “T” (as best I can given the different version of Xcode and what have you). I localized all my strings to Spanish and got the Spanish xib to look like the book. I deleted the app from the simulator and cleaned the product. Upon relaunching the app, tapping on the + button to go to the DetailViewController (which we I just localized as per above) crashes the app.

However, closing and restarting Xcode and THEN relaunching the app results in success. Extremely weird and frustrating because sometimes doing the right things results in unpredictable behavior, so it is very hard to know if you’re doing the right things to begin with.

Has anyone else encountered this or can anyone offer an explanation?


#2

Does the same thing happen if you reverse the sequence of operations?

That is, clean in Xcode; delete from the simulator; and then Build and run.


#3

I have the same crash. After I added the Spanish translation of the DetailViewController.xib, selecting the add button results in a crash. either is English or Spanish. The order of the Clean/Delete has no influence.

Removing the Spanish translation, and restoring the English version of the DetailViewController.xib in its original location, solved the problem. I have not yet figured out how to add the Spanish translation back to make it work.

I am using the Kindle version of the book, and XCode 4.6.


#4

I had the same problem, after localization the localized NIBs are not found.
In my case I’m not sure what ultimately worked, I came back to the problem after a couple of days during which I had deleted all the apps on my device and in the simulator. Also I deleted the Xcode built directories in the file system under “iPhone Simulator” for Homepwner and of course, restarting Xcode.
I don’t know what the explanation really is but it sure looks like once Xcode has figured out what NIB to load it really doesn’t want to start from scratch and figure it out again.


#5

Hi all,

First, thank you for commenting. It is reassuring to know that I am not the only one experiencing this.

I don’t really have the time to recreate the situation and see if doing things in a different order works or not, but thank you for the suggestion.

I can say that I localized a different project without problem, so maybe it is an Xcode thing that is a bit unpredictable.

I guess the bottom line is, when in doubt, first restart Xcode. lol


#6

I’ve had the same problem occur with xcode 4.6. After spending some time trying to debug it and failing to figure out what the issue was I did the restart xcode option and got it to work. Now I can’t get it to break in the same way. As a side note, I would love if BNR wrote a book for more advanced usage in the future!


#7

Anyone know the answer to this? I’m in the middle of running through this process, and I just came across the same thing. Deleted everything, did the clean… same exception being thrown.

*** Terminating app due to uncaught exception ‘NSInternalInconsistencyException’, reason: ‘Could not load NIB in bundle: ‘NSBundle </var/mobile/Applications/C7367DCD-70E3-403F-843A-CE7C9C8D069A/Homepwner.app> (loaded)’ with name ‘DetailViewController’’

I’m assuming it has something to do with the following DetailViewController.m code

- (id)initForNewItem:(BOOL)isNew
{
    self = [super initWithNibName:@"DetailViewController" bundle:nil];

#8

I got the same error. Indeed, restarting Xcode (version 4.6.2) resolved it for me. Now I see why the developers at my company are always complaining about Xcode being buggy…


#9

Having the same issue as the rest of y’all. I believe it is due to changes to Xcode post release of the book. I just started this chapter, and to be honest, I’m not that interested but will try and plow through. If I find an answer I’ll post it. Has anyone looked at errata for this book?


#10

[quote=“yukitosumi”]So, I am following the book to a “T” (as best I can given the different version of Xcode and what have you). I localized all my strings to Spanish and got the Spanish xib to look like the book. I deleted the app from the simulator and cleaned the product. Upon relaunching the app, tapping on the + button to go to the DetailViewController (which we I just localized as per above) crashes the app.

However, closing and restarting Xcode and THEN relaunching the app results in success. Extremely weird and frustrating because sometimes doing the right things results in unpredictable behavior, so it is very hard to know if you’re doing the right things to begin with.

Has anyone else encountered this or can anyone offer an explanation?[/quote]

I had similar issue. When I restarted XCode it does not crash. But even if I launch application when I have selected Spanish in Setting,
I get to see English xib file (even though as other users I managed to create Spanish version of the xib file in Xcode).
Any help?

ps. I also got this message when followed instructions in the book:

admin$ ibtool --import-strings-file ~/Desktop/DetailViewController.strings --write /Users/admin/Documents/XCode\ Projects/Homepwner/Homepwner/es.lproj/DetailViewController.xib /Users/admin/Documents/XCode\ Projects/Homepwner/Homepwner/en.lproj/DetailViewController.xib 2013-08-13 11:45:38.683 Interface Builder Cocoa Touch Tool[695:f07] CFPreferences: user home directory at file://localhost/Users/admin/Library/Application%20Support/iPhone%20Simulator/User/ is unavailable. User domains will be volatile.

maybe this is related to my problem as above?

Any help appreciated.