What is a Phonegap? Phonegap is a framework for developing apps using HTML5. It can be Android, iOS, WP, blackberry, Firefox and other mobile operating systems. Use HTML5 to write the interactive interface. Advantages: it can be compiled to a variety of mobile platforms, greatly saving the development cycle for the company. Disadvantages: performance such as native good, can only do some simple APP, such as the introduction of the company, or website client. If it’s a game, forget it. PhoneGap integration has one more platform. The application loads and the UI reacts slower than the native application, and the UI responds later-a fatal flaw. It’s actually still presenting the Web page, so loading, page refreshing, and so on will definitely take some time. PhoneGAp is still no substitute for native apps in terms of user experience. In addition, HTML, javascript, and CSS all run on webKit, the built-in browser of each platform, and are affected by the processing speed of WebKit. At present, the operation speed is relatively slow and the performance is poor.

Installing a Phonegap environment on a MAC requires a variety of third-party applications. Git, xocde, nodejs, etc!

1. Install GIT:http://www.git-scm.com/

2. Install NODEJS: http://nodejs.org/

3. Access the cli of the terminal and use NPM to install cordova.

$ sudo npm install -g cordova

Copy the code

4. Go to the project directory you want to create and create the PhoneGap project.

5. Enter the project you just created. At this point, you can add plug-ins or platforms in any order.

$ cd hello

$ cordova platform add ios

Copy the code

6. Add plug-ins (as required)

To add a plug-in, run the cordova plugin add * command

Device information plug-in:

  cordova plugin add org.apache.cordova.device  

Network connection plug-in:

  cordova plugin add org.apache.cordova.network-information  

  cordova plugin add org.apache.cordova.battery-status  

Gyroscope:

  cordova plugin add org.apache.cordova.device-motion  

  cordova plugin add org.apache.cordova.device-orientation  

  cordova plugin add org.apache.cordova.geolocation  

Camera photographing and recording:

  cordova plugin add org.apache.cordova.camera  

  cordova plugin add org.apache.cordova.media-capture  

  cordova plugin add org.apache.cordova.media  

Access files:

  cordova plugin add org.apache.cordova.file  

  cordova plugin add org.apache.cordova.file-transfer  

Remind:

  cordova plugin add org.apache.cordova.dialogs  

  cordova plugin add org.apache.cordova.vibration  

Contacts:

  cordova plugin add org.apache.cordova.contacts  

Globalization:

  cordova plugin add org.apache.cordova.globalization  

Flash screen (splash screen) :

  cordova plugin add org.apache.cordova.splashscreen  

Open a new browser (InAppBrowser):

  cordova plugin add org.apache.cordova.inappbrowser  

Debug the main console:

  cordova plugin add org.apache.cordova.console 

Copy the code

7. Open Finder, shift+ Command +G open ***, go to folder ***, type Platforms /ios, compile and run HelloWorld.xcodeProj.

Note: The distribution in the Platforms /ios folder is shown below

8. Final Results:

9.Xcode directory structure: