I'm developing an iPhone app in Xcode 4.6.2 that only has one target, and I've noticed that some important files are not members of my target. None of my custom header files are part of the target membership, nor is my Info.plist, my Prefix header, or the product "MyApp.app."
The way I understand targets, these files certainly need to be members of the target.
My question is: why aren't these files members of my target?
After searching around on SO, similar questions have yielded some insight, but not a complete answer to that question. The insight I've gathered is:
Header files are not members of your target because they get linked in the "Copy Headers" Build Phase.
Info.plist and Prefix.pch aren't members of the target because Info.plist gets linked in the "Copy Bundle Resources" Build Phase, and the Info.plist contains a key/value entry that points to the prefix header (Prefix.pch)
Select all the . m files in the "Project Editor" ( cmd-1 ), show the "Utilities View" ( opt-cmd-0 ) and click the new target in "Target Membership". Be careful not to select files that do not belong to a project such as .
To view and add dependencies, select a target and open its build phase settings. The Dependencies build phase contains the targets that Xcode must successfully build before it builds the current target. Xcode can build multiple dependent targets simultaneously if there are no interdependencies between those targets.
A Target specifies a product to build and contains the instructions for building the product from a set of files in a project or workspace. An Xcode scheme defines a collection of targets to build, a configuration to use when building, and a collection of tests to execute.
Header files are what other source files reference so that they know what the interface for a class is. They aren't needed as part of the binary itself, so they don't need to be included in the final product.
Info.plist
is a special case as it defines the application bundle itself, so it is processed separately.
Generally speaking, you want files to be members of your target when they:
.m
) files or libraries), orYou don't need files to be members of your target if they are only used as part of the build process and aren't needed at runtime. Typically this is any type of header file, including precompiled headers (.pch
).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With