c++iosxcodexcode4.5

Xcode Copy Files Build Phase - what do the "Destination" options mean?


Xcode Copy Files Build Phase Destinations

The Xcode docs for this don't explain exactly where each of the Destination paths maps to on disc, relative to my application package.

If I use this app as an example, could someone give a canonical answer where each will put files relative to this directory structure?

Xcode directory structure


Solution

  • The app bundle in your example is Viewer. This is not a file; it's a directory. If you click on it and "Show Package Contents", you'll see the rest of it.

    Products Directory is the directory that Viewer is written to. You cannot write to this directory in iOS.

    For iOS, Wrapper is the top level directory within Viewer.

    For iOS, Executable is the same directory as Wrapper.

    For iOS, Resources go into either the Wrapper directory, or the localization directories (Base.lproj, etc) if the resource is localized.

    The other directories aren't meaningful for iOS.

    Still, you should use the directories logically. Use "Executable" to mean "the directory where my executable lives." Don't assume that the directory tree is laid out a particular way internally.

    Regarding your comment that you need to know the path to access the file, you do not need that (and shouldn't try). You should use [NSBundle pathForResource:ofType:] to find files.