Can't get ibtool to generate Spanish xib


I’m on p. 321, where it says:

ibtool --strings-file ~/Desktop/ItemDetailViewController.strings --write

This is a typo, by the way: those should say “ItemViewDataController.xib”, not “Homepwner.xib”.

Anyway, in my terminal window, I’m inside my project directory, so I’m trying:

ibtool --strings-file ~/Destkop/ItemDetailViewController.strings --write es.lproj/ItemDetailViewController.xib en.lproj/ItemDetailViewController.xib

But all I get is:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
<plist version="1.0">
			<string>The stringsfile ItemDetailViewController.strings does not appear to contain valid data for UTF-16 string encoding.</string>

I don’t even have any special characters in my strings file at this point. I can’t find any information anywhere on the web on how to troubleshoot this. Please help!


I found the solution to my problem, so here it is for anyone else who runs into it!

There are two steps missing from the instructions on p. 321 in the book:

  1. After the ItemDetailViewController.strings file is created on your Desktop, open it in Xcode; it will appear in a window completely separate from your project, so you may not see any controls at all. If that’s the case, click on the lozenge on the right end of the window title bar to reveal the toolbar, from which you can show the utilities area.
  2. In the utilities area, select the file inspector, and in the Text Settings change the Text Encoding to UTF-16; at the prompt, choose Reinterpret.

Now you can run ibtool on the command line, from within your project directory, to generate the Spanish xib from your ItemDetailViewController.strings and the English xib:

    ibtool --strings-file ~/Desktop/ItemDetailViewController.strings