简体   繁体   中英

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.

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?

As an example, if I download XCode 6 today (iOS 8 was just released), I get the iOS 8 SDK and a simulator. 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?

In my head, the iOS 7.0 Simulator is an app. Does the iOS 7 SDK come with it so that you can build your app for iOS 7 compatibility?

No, downloading a simulator doesn't add any new SDKs. 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). This way your app supports both iOS 8 and iOS 7. There is no need for the 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; eg iPhone 5s (7.1) .

Xcode 6 only ships with iOS 8 SDK. This this the "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. The "Deployment Target" (IPHONEOS_DEPLOYMENT_TARGET) defines the lowest supported version of iOS you support. 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.

An app compiled against (Base SDK) 7.1 will run on iOS 8.0 devices. You can think of this as "iOS 7 mode". 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. The moment they were compiled against iOS7.x "Base SDK", they looked appropriate for iOS6 or 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. 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. 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.

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. Some methods may behave differently (though Apple strives to maintain API compatibility), and other methods will be deprecated or just different. The docs do a pretty good job about spelling out differences and deprecations.

What is your need for the older SDKs? Newer SDKs contain markup that allows you to build against the newer SDK with an older deployment target. 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

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.

--

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. The iOS Simulator.app is a small application that basically boots up the simulated device (by way of CoreSimulator.framework) and handles I/O.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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