Reputation: 11515
If I include files in my Xcode project, how can I control or specify which files are included as a part of the application's bundle?
For example, all the PNG files I add to the project always wind up in the bundle. Conversely, the .m and .h files are not.
How can I control or specify which are or are not included?
If I through in something - like some random data file - how do I know if it gets built into the bundle or not?
Upvotes: 1
Views: 614
Reputation: 17275
In general, files (like .h & .m) are the exception. If Xcode doesn't know something special to do with them (e.g., compile), they're just included.
At some point, I thought Xcode would run a special rule on even PNGs (to optimize their size).
Upvotes: 0
Reputation: 4782
To control what is copied you can do the following:
Upvotes: 1
Reputation: 3149
Right click on the file (either class file or resource file) which you don't want to include, select Get Info. Go to "Targets" tab. Check/Uncheck the box near the target name, for include/exclude the file.
Notes:
1) header files are by default excluded from the target. Only source files (.m or .mm or .cpp, etc) & resource files (.png, .jpg & all others) are required to be include/exclude from target.
2) If you exclude any source file from target then by default it's header file will get excluded & that source file won't compile.
3) Similarly, if you exclude resource file, it won't be copied into the bundle & thus any reference in your code to that file, will result into the crash of the application.
Upvotes: 2
Reputation: 36143
You control what gets copied where during a build by controlling what's listed in the various Copy Files phases of the build target.
Upvotes: 1