How to add js file to my xcode project?

jin picture jin · Jan 7, 2010 · Viewed 20k times · Source

I add some js and css files in my xcode left project tree. but when I build this project , I got the warning : no rule to process file '$(PROJECT_DIR)/js/builder.js' of type sourcecode.javascript for architecture i386

I think if I lost some setting with my project in xcode , but How to add some like js and css files? Thank you very much!

Answer

Rob Keniger picture Rob Keniger · Jan 7, 2010

When you add the JavaScript file, Xcode detects that the file is a source code file, assumes you want to compile it and automatically adds it to the Compile Sources build phase.

To stop Xcode trying to compile it and make it copy the file instead, expand your target in the Groups and Files list, remove the JavaScript file from the Compile Sources build phase and add it to the Copy Bundle Resources build phase.