I’ve just come across another rather serious problem in Xcode 2.1. The option for “Preprocess Info.plist File” allows you to use variable substitution in your Info.plist files (and hopefully your InfoPlist.strings files too although I’ve not checked that yet). It’s handy because you can do stuff like:
<key>CFBundleExecutable</key> <string>$(PRODUCT_NAME)</string>
However I turned on the feature for my Spotlight importer projects and found it was breaking my Info.plist files. The problem is that the pre-processor treats the // in URLs as a C++ style comments and strips out the remainder of the line:
Here’s my notes on how to reproduce (from the bug I file at http://bugreporter.apple.com/, bug #4147706)
Create a package based project in Xcode 2.1 (e.g. a Cocoa bundle). Modify the Info.plist to include a URL:<key>URL</key> <string>http://www.apple.com/</string>In the target settings turn ON the option for “Preprocess Info.plist File”. Build the project. Open up the output file’s package and inspect the Info.plist in a text editor, the URL will now look like this:<key>URL</key> <string>http:The // in the URL is being treated as a C++ style comment and the remainder of the line is being stripped.
Update: Turns out there is an easy solution. You can use pass through arguments to the C pre-processor to disable comment discarding. Configure your target like so:
INFOPLIST_PREPROCESS = YES INFOPLIST_OTHER_PREPROCESSOR_FLAGS = -C
From the cpp(1) man page:
-C Do not discard comments. All comments are passed through to the output file, except for comments in processed directives, which are deleted along with the directive.
There is also a -CC option that does the right thing for macro expansion. Check out the man page.
Add New Comment
Viewing 2 Comments
Thanks. Your comment is awaiting approval by a moderator.
Do you already have an account? Log in and claim this comment.
Do you already have an account? Log in and claim this comment.
Do you already have an account? Log in and claim this comment.
Add New Comment