objective-c xcode中Base SDK、iOS部署目标、Target、Project是什么意思

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/18568572/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-03 20:56:39  来源:igfitidea点击:

What's the meaning of Base SDK, iOS deployment target, Target, and Project in xcode

objective-cxcode4.5

提问by user4951

Say I set base SDK to 7, what does it mean? It could mean that the app would run on iOS 7. But that's what iOS deployment target is for.

假设我将base SDK设置为7,这是什么意思?这可能意味着该应用程序将在 iOS 7 上运行。但这就是 iOS 部署目标的用途。

Also why do I specify those 3 values in both project and target. It doesn't make sense. Why specify the same thing twice?

另外为什么我要在项目和目标中指定这 3 个值。这没有意义。为什么要指定相同的东西两次?

采纳答案by trojanfoe

The base SDK is what you build your app against (i.e. include and library files and frameworks). As you say, it doesn't affect the deployment target, except that base sdk >= deployment target.

基础 SDK 是您构建应用程序的基础(即包含和库文件和框架)。正如您所说,它不会影响部署目标,除了基础 sdk >= 部署目标。

You specify build settings on 2 levels as each project can have multiple targets and you might not want the same settings for all targets. The project-level settings override the default settings and the target-level settings override the project-level settings.

您可以在 2 个级别上指定构建设置,因为每个项目可以有多个目标,并且您可能不希望所有目标都具有相同的设置。项目级设置覆盖默认设置,目标级设置覆盖项目级设置。

For example I have projects with both OSX and iOS targets and some are ARC and some are MRR. I'd have to have different projects for each if I was unable to specify build settings with the level of granularity that Xcode allows.

例如,我有 OSX 和 iOS 目标的项目,有些是 ARC,有些是 MRR。如果我无法以 Xcode 允许的粒度级别指定构建设置,我就必须为每个项目创建不同的项目。

回答by onmyway133

In the iOS 7 TechTalk, session Architecting Modern Apps, Part 2, they explain this clearly

iOS 7 TechTalk会议架构现代应用程序,第 2 部分中,他们清楚地解释了这一点

enter image description here

在此处输入图片说明

Good read Hi! I'm #available!

好读嗨!我有空!

So, a modern App might use iOS 9 as the Target SDK, and iOS 7 as the deployment target. This means that you can run on iOS 7, iOS 8 and iOS 9, and that you have available to you any iOS 9 calls when actually running on iOS 9.

因此,现代应用程序可能使用 iOS 9 作为目标 SDK,使用 iOS 7 作为部署目标。这意味着您可以在 iOS 7、iOS 8 和 iOS 9 上运行,并且在 iOS 9 上实际运行时,您可以使用任何 iOS 9 调用。

You can read more in my post SDK and Deployment Target

您可以在我的帖子SDK 和部署目标中阅读更多内容

回答by V1ru8

Base SDK is the SDK you link against. Deployment Target is the minimum required iOS version you application needs to run. You can build an application with SDK 7 that runs under iOS 6. But then you have to take care to not use any function or method that is not available on iOS 6. If you do, your application will crash on iOS 6 as soon as this function is used.

基础 SDK 是您链接的 SDK。部署目标是应用程序运行所需的最低 iOS 版本。您可以使用 SDK 7 构建在 iOS 6 下运行的应用程序。但是您必须注意不要使用任何在 iOS 6 上不可用的函数或方法。如果这样做,您的应用程序将在 iOS 6 上崩溃使用此功能。

See the apple documentation for more details: https://developer.apple.com/library/content/documentation/DeveloperTools/Conceptual/cross_development/Configuring/configuring.html

有关更多详细信息,请参阅苹果文档:https: //developer.apple.com/library/content/documentation/DeveloperTools/Conceptual/cross_development/Configuring/configuring.html