View Full Version : Seeking help with Localized strings (Hillegass' book, ch. 16)
Jun 23, 2008, 01:04 AM
I am working my way through Cocoa Programming for Mac OS X and have run into a major stumbling block. I've attached the screenshot from my program. Basically, I replaced a portion of one method with something almost identical, but the program no longer runs. Take a look at the attachment - can anyone see where I went wrong?
Mahalo in advance for your assistance,
Jun 23, 2008, 10:59 AM
First of all, the following line is probably wrong.
I don't know a lot about localized strings, but you're probably going to have to do something like this. This is uncompiled, so it may not be correct either.
Secondly, you forgot a close parentheses in this line.
informativeTextWithFormat:NSLocalizedString(@"SURE_DELETE", @"Do you really want to delete %d people?", [selectedPeople count]];
Jun 24, 2008, 02:59 AM
Thanks for the head's up on the missing paren. As for the first comment, I used nil in the commented out section (what was there previously) and it worked fine. When I completed the localization section, I had to modify the code. Instead of deleting the existing code, I simply commented it out and entered in the new code from the book. I also imported the Foundation class to the MyDocument.h file, but got the errors noted in the attached file.
Jun 24, 2008, 03:37 AM
I finally figured out the problem. In the line you originally noted as not having the closing paren, I had also typed 'NSLocalizedString' which was unnecessary. Once I took it out, everything works normally. Thanks for giving my code a once-over.
Jun 24, 2008, 09:47 AM
No problem, and sorry I didn't catch the mis-spelling. When I saw the errors, I thought spelling might have something to do with it but I couldn't see that it was mis-spelled.