To build and run Ionic app onto iOS Devices. I will need to have Xcode software running on Mac OS. In this case, I had my macOS installed on my Windows using VMware Workstation which is a virtual machine, allowing different types of OS to be installed. Before I can compile and run Ionic app, I need to run the two command-lines for the first time.
I run xcode-select --install on the terminal to enable Ionic to run.
Then, I have to run sudo npm install -g ios-deploy — unsafe-perm=true
Now, make sure that iOS platform is installed or I need to run this command ionic platform add ios.
After finishing the above processes, ionic cordova build ios is required to run inside my project folder.
I can now open my Ionic project in the Xcode with the file ending in .xcodeproj.
Once I opened the project in Xcode, I will need to assign my team on the project. First, I click on Xcode -> Preferences… then sign into my Apple account.
I can now choose my Team in signing section.
I am now able to select my iOS device as seen below. Then press the build and run button. Or I can run ionic cordova build ios after I have my device selected. Or I can also run ionic cordova build ios --device if I have not selected any real devices yet.
In addtion, I can also run Ionic app on simulator by typing this command ionic cordova emulate ios. Or select an emulator in Xcode then click on build and run button it.
One thing to consider is that if the device version is below the default Deployment Target which is 9.0. I need to set to lower version to match my device. In this case, my device is running on 8.1 version.
Also, ensure that CordovaLib in Targets section, iOS Deployment Target is also set to specific version that match the device version. For Cordova in Targets section and CordovaLib in Project section do not need to match particular version of the device.
Otherwise, I will get this error message.
Wrapping Up
Deploying an Ionic app onto iOS devices is that simple and easy. Cheers!