65

Environment: Version 8.2 beta (8C30a)

My schema list only devices.
How do I change the iOS version in simulator?

I can see the available iOS Simulators...

enter image description here

...but they're not listed in the schema list.
Nor is their a way to discriminate amongst the iOS versions within schema manager.

enter image description here

Frederick C. Lee
  • 9,019
  • 17
  • 64
  • 105

3 Answers3

95

The list of available simulators is dictated by three factors:

  1. It will not show you simulators whose iOS version is prior to that of your current app's deployment target. If you want to see some recent, prior iOS simulators, make sure your app's deployment target is set accordingly.

    deployment version

  2. If you go to Xcode "Preferences" - "Components", you can confirm which iOS simulators are installed on your machine.

    components

  3. In Xcode's "Devices" window (shift+command+2), as shown in the snapshot in your original question, you can configure particular simulator devices for your Xcode environment.

Rob
  • 415,655
  • 72
  • 787
  • 1,044
  • I can't get my iOS-10 APIs to compile if I lower my deployment target to iOS 9.3. I want to incorporate BOTH iOS 10 & 9 APIs and determine runtime course accordingly. I can't do that if I don't set the deployment target to iOS 10. Once in iOS 10, I should be able to use compiler flags within the code to determine iOS-specific logic course. But then I can use the iOS 9 simulators....conundrum. – Frederick C. Lee Nov 17 '16 at 23:05
  • In Swift, you need to wrap your iOS 10 API in `if #available(iOS 10, *) { ... }`. – Rob Nov 17 '16 at 23:16
  • I know... but first I have to set the deployment target to iOS 10. But doing so, I miss the iOS 9.0+ simulators listed in the schema; and I'm back to square 1. – Frederick C. Lee Nov 17 '16 at 23:22
  • 1
    No, set your deployment target to iOS 9 (or whatever) and then in your Swift code, wrap your iOS 10 API with `if #available(iOS 10, *) { ... }` and that will silence the "xxx is available on iOS 10 only" error message. – Rob Nov 17 '16 at 23:24
  • 1
    Sounds like there's confusion between Base SDK and Deployment Target. Rob's correct, set your Deployment Target to the MINIMUM sdk that you want to support (so 9). You'll still be able to use iOS10 APIs so long as your Base SDK remains set to 10. If both are set to 10, you can't run on iOS 9 simulators. You can't even run on iOS9 devices! – charmingToad Nov 18 '16 at 04:16
  • I found that I should use the '@available()' for class/extension level coverage. However I'm still running into protocol-function coverage. I've asked a follow-up question here: http://stackoverflow.com/questions/40670889/how-do-i-handle-available-for-protocol-function-overrides – Frederick C. Lee Nov 18 '16 at 06:45
  • Thank you. too much effort to find such a small thing. :) – Dinesh Raja Feb 14 '17 at 15:24
  • Just to add that to download an iOS version from that 'Components' window, one has to click on the tiny, greyed-out, inactive-looking arrow icon to the left of the version. Took me a while to figure that out. – BoDeX Sep 27 '19 at 08:31
6

Open your xcode and press command + shift + 2.

Device/simulator dialog

Click on left bottom + button and your new simulator with required iOS version.

Add simulator dialog

Click create, now you are ready to use the new simulator.

Shahbaz Hashmi
  • 2,631
  • 2
  • 26
  • 49
0

After adding the @availability & #availability flags which allowed me to get a successful compiled under and older distribution target, I noticed that the iOSes came back:

enter image description here

Frederick C. Lee
  • 9,019
  • 17
  • 64
  • 105