When I start a new project in XCode, it always sort of bugs me that so many things are tossed into the main project directory. I suspect I’m not alone there. To resolve that, one of the first things that I do is start organizing stuff. Two folders immediately get created: “resources” and “src”. I throw Info.plist and the English.lproj bits into resources and main.m and the precompiled headers into src. No big deal, right? Well, sorta.
As soon as you do this the XCode project will whine a bit at you (whining in this case takes for the form of the files in the project browser getting listed in red).
This part is very easily to resolve – just click on them and choose Get Info. Once you’ve got that up, click on the “Choose…” button and you’ll get a standard file navigation window. Just click into the directory you’ve stashed the file into and select it.
This all worked great for me and I thought I had everything settled there until I tried to build… and damn, it didn’t work. The message I got back (after a little quick digging into the build results window) was error: The file “Info.plist†does not exist.
.
Damned annoying message, because I know it exists – I just moved it.
The resolution to it really isn’t that bad, but it can be confusing. There is a build configuration “Info.plist File” that you can set. But where you really want to set it is on the target, not the project. Turns out you can set it in both places, and when I set it in just the project, it didn’t fix the problem. To resolve, find your build target and choose “Get Info” there. Click on the “build” tab and find the configuration setting (the built in search mechanism is a joy here).
You’ll see in the above example that Info.plist is sort of highlighted. Just double click on the value and change it to (in my case) resources/Info.plist and click on “OK”. If you’ve moved your precompiled headers, you’ll want to do a similar adjustment to the setting “Prefix Header”.Â
Once you’ve got that completed, you’re back in action and can compile your code up without issue. And yeah, for the record – I fully expect that I’ll forget this and come looking for it again in another 9 months or something. I just hope I can find it then…
Good post! thanks 🙂
LikeLike
I agree with you completely – but I find creating a project template is much easier (less tedious) than removing the cruft each time.
LikeLike
I’m digging up one of your old posts – apologies. If you try to move the PCH out of the project root directory, Xcode still complains (both on Mac and iPhone builds). Any idea how to get around that one?
LikeLike
Dude – you rock! I’ve been changing the wrong INFOPLIST_FILE setting for over an hour. Uggh!
LikeLike
Great tip, also saved a INFOPLIST_FILE headache from getting worse!
LikeLike