Xcode 复制文件构建阶段 - “目标”选项是什么意思?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19156490/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Xcode Copy Files Build Phase - what do the "Destination" options mean?
提问by Mr. Boy
The Xcode docsfor this don't explain exactly where each of the Destination paths maps to on disc, relative to my application package.
与我的应用程序包相关的Xcode 文档并没有准确解释每个目标路径映射到磁盘上的位置。
If I use this app as an example, could someone give a canonical answer where each will put files relative to this directory structure?
如果我以这个应用程序为例,有人能给出一个规范的答案,每个人都会把文件放在这个目录结构中吗?
采纳答案by Rob Napier
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.
您示例中的应用程序包是Viewer
. 这不是一个文件;它是一个目录。如果您单击它并“显示包内容”,您将看到它的其余部分。
Products Directory is the directory that Viewer
is written to. You cannot write to this directory in iOS.
产品目录Viewer
是写入的目录。您无法在 iOS 中写入此目录。
For iOS, Wrapper is the top level directory within Viewer
.
对于 iOS,Wrapper 是Viewer
.
For iOS, Executable is the same directory as Wrapper.
对于 iOS,Executable 和 Wrapper 是同一个目录。
For iOS, Resources go into either the Wrapper directory, or the localization directories (Base.lproj
, etc) if the resource is localized.
对于 iOS,Base.lproj
如果资源已本地化,则资源进入 Wrapper 目录或本地化目录(等)。
The other directories aren't meaningful for iOS.
其他目录对 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.
关于您评论说您需要知道访问文件的路径,您不需要(也不应该尝试)。您应该使用[NSBundle pathForResource:ofType:]
来查找文件。