简体   繁体   English

iOS模拟器的旧版本是否与iOS SDK相同?

[英]Are older versions of iOS Simulator the same as the iOS SDK?

Like many people do, I have a need to build applications with older versions of the iOS SDK. 像许多人一样,我需要使用旧版iOS SDK构建应用程序。

When I download an older version of the iOS simulator through the XCode preferences, is this the same as downloading a previous version of the SDK? 当我通过XCode首选项下载旧版本的iOS模拟器时,这与下载以前版本的SDK相同吗?

As an example, if I download XCode 6 today (iOS 8 was just released), I get the iOS 8 SDK and a simulator. 举个例子,如果我今天下载XCode 6(iOS 8刚刚发布),我会得到iOS 8 SDK和模拟器。 If I need to compile apps for iOS 7 and use the Downloads feature in XCode preferences to get iOS 7.0 Simulator does that come with the iOS 7.0 SDK? 如果我需要为iOS 7编译应用程序并使用XCode首选项中的“下载”功能来获得iOS 7.0 SDK附带的iOS 7.0模拟器吗?

In my head, the iOS 7.0 Simulator is an app. 在我看来,iOS 7.0模拟器是一个应用程序。 Does the iOS 7 SDK come with it so that you can build your app for iOS 7 compatibility? iOS 7 SDK是否附带它,以便您可以构建适合iOS 7兼容性的应用程序?

No, downloading a simulator doesn't add any new SDKs. 不,下载模拟器不会添加任何新的SDK。 There's no need. 没有必要。 With Xcode 6, your apps should have a Base SDK of iOS 8. You can set the Deployment Target as far back as 4.3 (though going any further than 7.0 is kind of pointless now). 使用Xcode 6,您的应用程序应该具有iOS 8的基本SDK。您可以将部署目标设置为早在4.3(尽管比7.0更进一步毫无意义)。 This way your app supports both iOS 8 and iOS 7. There is no need for the iOS 7 SDK. 这样您的应用程序就支持iOS 8和iOS 7.不需要iOS 7 SDK。

I think I understand what you're asking, as the answer is no: the iOS simulators are named for the hardware they simulate and the version of iOS that they run; 我想我明白你在问什么,答案是否定的:iOS模拟器是以他们模拟的硬件和他们运行的iOS版本命名的; eg iPhone 5s (7.1) . 例如iPhone 5s(7.1)

Xcode 6 only ships with iOS 8 SDK. Xcode 6仅附带iOS 8 SDK。 This this the "Base SDK" (SDKROOT). 这就是“Base SDK”(SDKROOT)。 You can think of it as a "best compilation target" or "best supported version" -- it's the SDK version you compile against. 您可以将其视为“最佳编译目标”或“最佳支持版本” - 它是您编译的SDK版本。 The "Deployment Target" (IPHONEOS_DEPLOYMENT_TARGET) defines the lowest supported version of iOS you support. “部署目标”(IPHONEOS_DEPLOYMENT_TARGET)定义了您支持的最低支持iOS版本。 As your app matures, and the range between the two widens, you need to do more and more runtime detection of supported features, or handle API differences, where for eg, a newer call is preferred on newer platforms, and nonexistent on older ones. 随着您的应用程序成熟,以及两者之间的范围变宽,您需要对支持的功能进行越来越多的运行时检测,或处理API差异,例如,较新的平台上首选较新的呼叫,而较旧的平台则不存在。

An app compiled against (Base SDK) 7.1 will run on iOS 8.0 devices. 针对(Base SDK)7.1编译的应用程序将在iOS 8.0设备上运行。 You can think of this as "iOS 7 mode". 您可以将其视为“iOS 7模式”。 A better example was the move from iOS6 to 7 -- apps compiled against iOS6.1 "Base SDK" ran on iOS7 devices but they looked like the old UI style. 一个更好的例子是从iOS6迁移到7 - 针对iOS6.1编译的应用程序“Base SDK”在iOS7设备上运行,但它们看起来像旧的UI风格。 The moment they were compiled against iOS7.x "Base SDK", they looked appropriate for iOS6 or 7. 在他们针对iOS7.x“Base SDK”进行编译的那一刻,它们看起来适合iOS6或7。

I have an app I'm supporting as "Base SDK" 7.1 at the moment, and I managed to copy over the old 7.1 SDK and compile against it. 我现在有一个应用程序作为“Base SDK”7.1支持,我设法复制旧的7.1 SDK并对其进行编译。 Honestly, it's more trouble than it's worth, IMHO. 哎呀,老实说,这比它的价值更麻烦。 If you still have Xcode 5 around, and require only up to 7.1 at the moment, you may just want to use that. 如果你仍然有Xcode 5,目前只需要高达7.1,你可能只想使用它。 Given that iOS 8.0 is out, and if your app is new, you probably don't need to worry about this at all -- you likely just want to make sure you support iOS 7.x, and that's AOK. 鉴于iOS 8.0已经淘汰,如果您的应用是新的,您可能根本不需要担心这一点 - 您可能只是想确保您支持iOS 7.x,那就是AOK。

Given an app that (for eg) has a deployment target of 7.0 and a base sdk of 8.0, any compatibility concerns are up to you to handle. 给定(例如)部署目标为7.0且基本sdk为8.0的应用程序,您需要处理任何兼容性问题。 Some methods may behave differently (though Apple strives to maintain API compatibility), and other methods will be deprecated or just different. 某些方法可能表现不同(尽管Apple努力维护API兼容性),其他方法将被弃用或仅仅是不同的。 The docs do a pretty good job about spelling out differences and deprecations. 文档在拼写差异和弃用方面做得非常好。

What is your need for the older SDKs? 您对旧SDK的需求是什么? Newer SDKs contain markup that allows you to build against the newer SDK with an older deployment target. 较新的SDK包含标记,允许您使用较旧的部署目标针对较新的SDK进行构建。 Great care is made to ensure that you don't actually need an older SDK, so if there is an issue that is preventing you from using a newer SDK, make sure you file a radar at http://bugreport.apple.com 我们非常注意确保您实际上不需要较旧的SDK,因此如果存在阻止您使用较新SDK的问题,请务必在http://bugreport.apple.com上提交雷达。

If you need to compile apps that will run on iOS 7, you should set a deployment target of 7.0 (or 7.1 depending on what your intent is) and just use the iOS 8.0 SDK. 如果您需要编译将在iOS 7上运行的应用程序,则应将部署目标设置为7.0(或7.1,具体取决于您的意图)并使用iOS 8.0 SDK。

-- -

The iOS Simulator SDKs double as both the SDK that is built against and the runtime (almost an entirely separate OS) that your simulator apps are run with. iOS模拟器SDK兼具构建的SDK和运行模拟器应用程序的运行时(几乎完全独立的操作系统)。 The iOS Simulator.app is a small application that basically boots up the simulated device (by way of CoreSimulator.framework) and handles I/O. iOS Simulator.app是一个小型应用程序,它基本上启动模拟设备(通过CoreSimulator.framework)并处理I / O.

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM