Search code examples
plistlintpbxprojxcode-project

Old-style plist linter


I am writing an application that generates .xcodeproj files. It's generated a .pbxproj file, however when opening it in Xcode, I get an error message, "cannot be opened because the project file cannot be parsed." and nothing more.

Is there a reliable application for syntax parsing old-style plists?

If it requires me to use low-level Cocoa APIs, I'm fine with that, but some pointers at least?


Solution

  • You should take a look at Xcodeproj.

    It's not a linter, but it may help you to understand why your project isn't being opened correctly.

    You have a few options:

    • Try to parse your project with Xcodeproj to see if it gives you more useful errors.
    • You don't mention what language you're writing in, but if it's ruby, you could simply use the gem directly.
    • See if you can call the CF calls directly. You'll note that the part of Xcodeproj that actually writes to the file calls this c extension which simply uses CFPropertyListWriteToStream.

    This all assumes that your problem is one that could actually be solved by a linter. If your formatting is correct but you're writing values that somehow confuse Xcode then these suggestions may not apply, although I do think reading through the Xcodeproj source would help you.