Xcode 目标部署目标与项目部署目标
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7105127/
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 target Deployment Target vs. project Deployment Target
提问by Alex
Excuse my ignorance, but what is the difference in Xcode between the Deployment Target field under "Targets" and the deployment target under "Project"?
请原谅我的无知,但是“目标”下的部署目标字段和“项目”下的部署目标在 Xcode 中有什么区别?
What happens if my project deployment target is 3.2, and my iOS Application Target is 4.0? Or vice versa?
如果我的项目部署目标是 3.2,而我的 iOS 应用程序目标是 4.0,会发生什么?或相反亦然?
回答by Ole Begemann
Target settings override project settings. Project settings are valid for all targets whose settings haven't been overridden.
目标设置会覆盖项目设置。项目设置对其设置未被覆盖的所有目标均有效。
回答by Andrej
Looking at the link form Apple docs... Looks like when you set the version at "target" levelyou specify the minimum required version that a user can have to run your app.
查看Apple docs的链接表单......看起来当您将版本设置为“目标”级别时,您指定了用户运行您的应用程序所需的最低版本。
On the other side, by setting the version at "project" levelyou specify what SDKs are available to you when you're developing. So if an API is available only to the latest version you get a compiler error notifying you that you have to handle the behaviour for missing API differently (probably using #available
or @available
).
另一方面,通过在“项目”级别设置版本,您可以指定在开发时可以使用哪些 SDK。因此,如果 API 仅适用于最新版本,您会收到编译器错误,通知您必须以不同方式处理丢失 API 的行为(可能使用#available
或@available
)。
This is how I untedstand the above image:
这就是我如何理解上面的图像:
- you can use all APIs from major version,
- your users can download the app only if they have at least "Deployment target" version installed
- you can use APIs up until the "Base SDK" version
- APIs above "Base SDK" version are not available to you in your project
- 您可以使用主要版本的所有 API,
- 您的用户只有至少安装了“部署目标”版本才能下载该应用程序
- 您可以使用 API 直到“Base SDK”版本
- 您的项目中无法使用高于“Base SDK”版本的 API