Have you ever wondered how to launch a specific iOS simulator directly using the ionic cli instead of launching XCode and choosing the simulator from the list? I have... many times... But I was always too lazy to look for the answer. As it turns out, it's pretty simple. And it's quite helpful when you want to debug your iOS app using Ionic's live reload feature!
So, as I said, when you run ionic on iOS with live reload, you run this:
But at the end of all these complicated build lines you can read:
Yes, it’s completely possible. Assuming your VM is set up, open up the Mac App Store. Install Xcode from the Mac App Store, it’s free, but it’s a big download, so make sure you have something to do while it’s downloading.
Ios Simulator For Windows
- Sometimes the iOS simulator doesn't respond to commands to open. If it seems to be stuck on this prompt, you can open the iOS simulator manually (open -a Simulator) and then in the macOS toolbar choose Hardware → Device and select an iOS version and device that you'd like to open.
- You may connect a real device to your Mac using a cable, or for iOS or tvOS apps, connect it over WiFi after you pair it with Xcode. For macOS apps, choose a scheme, then click the Run button in the toolbar. You can also run SwiftUI apps in the simulator or on a device using the controls in the preview.
'Oh! So I could specify a target!' And then the simulator launches and the idea of specifying a target just vanishes until the next launch.
Ios Simulator For Windows 10
Well, no more laziness, sir! Let's specify this bloody target!
There seems to be more than one command line available to do this, but hey, we only need one that's working. Just run:
Macos Run Ios Simulator
You should see a list of all the simulators available like this:
OK, so now we have our available simulators. We just need to specify it to Cordova! And that's done like that:
And that's it folks! The iPhone 6 simulator will launch instead of the default one. That was easy, right?
If you have questions or remarks concerning this article, please feel free to share them in the comments below!