In this tutorial, you will learn, how to view the Ionic 2 framework application in the iOS emulator. If you are new to the iOS application development using the Ionic 2 Framework, then this post will help you. This post explains, how to run and test the Ionic 2 application using the iOS emulator.
In Android application development, you are able to generate apk and preview the app on the physical android device without publishing to the Google Play Store. But you can not do the same for the iOS application. Why because, on the iOS device, you are not allowed to install the unidentified apps. So you can use the iOS emulator to preview the Ionic 2 application.
An example of iOS Emulator running on Mac OS sierra.
1. Mac OS
2. Xcode Editor
3. Ionic and Cordova
For this demo, I used
1. Mac OS Sierra
2. Xcode Editor 8
3. Ionic 2
4. Cordova 6.5
Use the below command in terminal, to create the Ionic 2 project
ionic start iosapp blank --v2
The above command will create an empty Ionic 2 project. Don't forget to include the --v2. If you forgot to include the --v2, then it will create Ionic Framework version 1 project.
Then get inside the project directory using
Then include the iOS platform to the project using
ionic platform add ios
However, the iOS platform added to the Ionic project by default in Mac OS while creating the Ionic 2 project. So it will say, the platform already added.
You can design your own custom application. Once you finished your design, then you are ready to run this application an iOS emulator. Use the below command to run the Ionic 2 project on iOS emulator.
ionic run ios
The above command will create Xcode project file and deploy the application in the default iOS emulator. Later you can change emulator device using the home menu.
To change your choice of iOS device emulator go to Hardware menu. Then click Device and choose iOS. Then click the preferred device from the menu.