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

倖福魔咒の 提交于 2019-12-12 08:40:35

问题


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?


回答1:


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 you 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.



来源:https://stackoverflow.com/questions/19156490/xcode-copy-files-build-phase-what-do-the-destination-options-mean

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!