Wednesday, August 28, 2013

Setting up Apache Cordova iOS project on XCode

In the previous blogs we have seen how to set up a mgwt project on eclipse, Apache Cordova Android project on eclipse and Apache Cordova Android Project on Android Studio.

Now we will move to setting up an Apache Cordova iOS project on XCode. XCode is the default IDE Apple provides for developing iOS applications.

First we need to install XCode from Mac store. Just search for XCode and click on Install.

For creating a Cordova project we need to install nodejs and also cordova. So we need to repeat these installation steps on your mac also , if nodejs and cordova are not already installed on your mac.

Install NodeJS


Download the latest version of nodejs from the below link and install the nodejs library.

http://nodejs.org/

Then run the below command.

npm install -g cordova

Some times this command fails to run as it requires root or administrator privileges to install cordova for all the users using the mac. If you face any issues with root or administrator privilege, run the below command.

sudo npm install -g cordova


One the cordova installation is completed, we can create a cordova project.

Create iOS Project


Create an Apache Cordova iOS project running the below command.

cordova create IosCordovaTestApp



Now change to the project directory that was created in the previous step.

cd IosCordovaTestApp



Now add ios platform to the project created.

cordova platform add ios


Now we have created a cordova ios project, we will import it into XCode.

Configure in XCode


Launch XCode, and click on Open to import the project that is created.

Select the project, click on 'Open'.



Browse through the project you have created, IosCordovaTestApp --> platforms --> ios and select.


Once the project is imported, we can run it in an Simulators.

Simulators are available beside Stop button on the left corner of the XCode.


Click on Run button which will compile the application, launch the simulator, deploy the application in simulator and run the application in the simulator.


Once the simulator is launched and application is installed, we can see the Apache Cordova iOS project launched which will display a screen above.

We have just created a blank project and so this is fine for now.

Later we will modify the project with our changes and view them running the simulator.

We have completed setting up all the required tools and environment to build a cross platform mobile application. So in the next blogpost we can start building a demo app and run it on different mobile OS.


9 comments:

  1. Thanks for sharing such a great blog..Keep posting..

    JAVA Training

    ReplyDelete
  2. This post covers how to get your app into xcode! Invaluable.

    ReplyDelete
  3. Nice and good article. It is very useful for me to learn and understand easily. Thanks for sharing your valuable information and time. Please keep updating.
    Top Web Design Training India

    ReplyDelete
  4. You have provided a nice article, Thank you very much for this one. And I hope this will be useful for many people. And I am waiting for your next post keep on updating these kinds of knowledgeable things.
    DOT NET Training in Chennai
    Hadoop Training in Chennai
    Android Training in Chennai
    Selenium Training in Chennai
    JAVA Training in Chennai
    German Classes in chennai
    PHP Training in Chennai
    PHP Training in Tambaram

    ReplyDelete
  5. This comment has been removed by the author.

    ReplyDelete