I have a plist file that I used in my app that I can localize so I get two entries in my project, one for English and one for Spanish and when I compile an run the app it works but of course at this stage the contents are identical.
I then in Finder replace the Spanish plist with one that has been translated for me into Spanish and I can in the XCode editor view the content without problem.
However when I try to compile I get an error stating:
.../en.lproj/myData.plist:0: error: reading plist: The data couldn’t be read because it has been corrupted.
But the English one has not been touched?
Surely you can copy a localized file into the project in this manner?
open disk utility repair permissions.
open terminal and run this command:
plutil -s /somewhere/yourfile1.plist
It will make you focus with all details of the problem by showing you the exact error and line. So you'll have to go the reported line & fix it by yourself with a text editor.
One thing that can happen is someone messed up one of your tags.
In Xcode right click on your Spanish plist, select Open AS then Source Code
Then check your plist to ensure all of your opening and closing tags are still there, there are no typos, are there any garbage characters in there, and that you are not trying to use a string in an integer etc:
Example:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>1</key>
<dict>
<key>a</key>
<string>a1</string>
<key>b</key>
<string>b1</string>
</dict>
<key>2</key>
<dict>
<key>a</key>
<string>a2</string>
<key>b</key>
<string>b2</string>
</dict>
<key>3</key>
<dict>
<key>a</key>
<string>a3</string>
<key>b</key>
<string>b3</string>
</dict>
</dict>
</plist>
I once had some problems when something was copied and pasted into Xcode from a PDF (some kind of incorrect symbol maybe?) and it worked fine when I just re-entered it. Also its often difficult to generate a valid plist from a word processor.
That can also happen with strings file if you forget the semicolons at the end of the lines. Silly me.
This can also happen if you have an & within a string.
Replace:
<string>SomeText & SomeMoreText</string>
With:
<string>SomeText & SomeMoreText </string>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With