iOS Cordova/Phoengap project setup guide on Mac
In
this post, I will help you set up PhoneGap Command Line Interface on
Mac for iOS. I will try my best to cover all the aspects. If you are
facing any issues while setting up, do drop a comment & I can
take a look at the issue.
First
of all, let me tell you what is Phonegap. So, PhoneGap
is an open source framework for quickly building cross-platform
mobile apps using HTML5, Javascript and CSS.
Building
applications for each device–iPhone, Android, Windows Mobile and
more–requires different frameworks and languages. PhoneGap solves
this by using standards-based web technologies to bridge web
applications and mobile devices. Since PhoneGap apps are standards
compliant, they’re future-proofed to work with browsers as they
evolve.
The
PhoneGap code was contributed to the Apache Software Foundation (ASF)
under the name Apache
Cordova
and graduated to top-level project status in October 2012. Through
the ASF, future PhoneGap development will ensure open stewardship of
the project. It will always remain free and open source under the
Apache License, Version 2.0.
Nitobi
was the original creator and is one of the primary contributors to
the PhoneGap framework. In October 2011, Adobe acquired Nitobi
enabling the team to focus solely on the PhoneGap project and
continue its work on efficient development across mobile platforms.
Here
are the following steps that you have to follows to install and setup
the cordova/phonegap project for iOS in your mac.
Step 1:Install
Nodejs. You can find a tutorial here
on how to setup Node. We will leverage Node Package Manager to setup
Cordova & PhoneGap
Step 2: Install PhoneGap – Run sudo npm install -g phonegap
Step 3: Install Cordova Command Line tools – Run sudo npm install -g cordova
Step 4: Install HomeBrew. We will use HomeBrew to setup Ant on our system. If you don’t have HomeBrew, run ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install )" at your terminal.
Step 5: Install Apache-Ant. Run brew update & then install ant brew install ant
Step 6: For iOS development, Run to the App Store & Download the latest version of XCode. After the installation is completed, launch the application & accept the license, terms.
Step 8: Open terminal here & Run phonegap create myFirstApp. This will setup the required files for a startup project.
Step 9: cd myFirstApp
Step 10: Then lets add a iOS platform instance. Run cordova platform add ios *
Note
: * If you are getting error related to your Xcode when you
adding iOS platform to your project in Step 10, then first set
your xCode path by running the following command.
$
sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
Now
continue from Step 10.
Step 11: Build the iOS project. Run cordova build ios After a stream of messages, you should see something like this
Step 12: Navigate to myFirstApp/platforms/ios. You will see a myFirstApp.xcodeproj. Double click it to launch the project in Xcode.
Step 13: Once the project is loaded, lets Build the project. From the top Menu, Product > Build for > Testing. You should a Build Succeeded message.
Step 14: Click on the Play button on the top left hand of the screen. Wait for a few moments for the iOS simulator to launch & you should see a Device Ready message on iOS Simulator.
Comments
Post a Comment