iPhone Developer Tips Stats: Past 30 days - Pageviews: 88,766 Visitors: 61,679 Thank you everyone! Let's shoot for 100,000 by May. Pass it on...
|
By default, when you create a new file or import a file into Xcode, if the file type is recognized as a source file (.c, .m .js, etc), the file is added to the Compile Sources folder in the application target.
You may not always prefer this default action – for example, if a JavaScript file is imported, Xcode does not know what to do with this file type so a compile warning is generated, see the example below:

I ran into this recently when I added a JavaScript file that is associated with an Openx ad that I wanted to displayed inside my application, using a UIWebView.
There is a simple fix, drag/drop the offending file(s) from the Compile Sources folder to the Copy Bundle Resources folder within the applications Target, which will simply include the file in the application bundle with no processing of the file (this is where you will typically see image files, sound files, etc).
In the image below, the file foo.js has been moved into the Copy Bundle Resources folder:

Comments
2 Responses to “Tell Xcode Not to Compile a File”
Leave Comment
Your providing information is good and useful to develop the i-phone software
This is great – thanks.
I have the opposite problem!…..how do you force XCode to compile a file, even if it hasn’t changed?
(I’m trying to create a project level build timestamp without going down the route of running XCode from a script).