bdunagan

fill the void - bdunagan

20 Apr 2017
Xcode Tip: Diagnosing 'Read Failed' for .strings file with plutil

Recently, I found a certain .strings file was producing an error for Retrospect’s iOS app in Xcode, specifically:

Example.strings:0: error: read failed: The data couldn’t be read because it isn’t in the correct format.

This error is common enough to have a number of excellent StackOverflow answers. In their cases, there was a text error in the file, like a missing quote or semi-colon, and most referenced plutil -lint path_to_strings_file as the best way to identify the incorrect line.

The confounding factor in my environment was that the Retrospect for Mac project, which referenced the exact same file, built successfully. I tried (unsuccessfully) to resolve the problem by switching encodings and even downloaded HexFiend to poke around in the file. All useless.

As it turned out, the root issue was the same as everyone else’s: I had a quote missing. However, Xcode (7.3.1) behaves differently for iOS projects and Mac projects: the iOS one failed explicitly on the error and the Mac one failed silently. The Mac app simply wouldn’t see any string translations beyond that offending line.

Previous LinkedIn Twitter GitHub Email Next