How  PhoneGap Work on the iPhone 


                      Mobile...?
  
 How to PhoneGap iOS project is setup and  PhoneGap actually works on the iPhone so that you can better understand how to execute a PhoneGap function.
1) You will need to do is set up a PhoneGap project so please follow the guide for the  iOS PhoneGap project to install PhoneGap and create a PhoneGap project from the PhoneGap.
for this set up you will need to complete these steps using Xcode  supported phone gap – if you do not have access to Xcode click here for a starter project.

PhoneGap Project Structure:

Once you have created a project based off of the Phone Gap Template then we are ready to get started with a tour of the Xcode project:
In this image i will show how to use :- 
1. ‘www’ folder — In this folder where all of the static resources for the web view should be stored. This is also the location where the phoneGap build steps will copy the phonegap.js files and where you will place all of your own HTML/CSS/JS files.

2. index.html / phonegap.js script — the index.html is the start page of your application. In order to access PhoneGap functions you must include the phonegap.js script reference on the index.html and any other html page from where you will call PhoneGap functions.

3. PhoneGap classes — PhoneGap provides an extension to the typical iOS classes for the UIApplicationDelegate (which implements the UIWebViewDelegate methods) and the UIViewController. These classes perform most of the “magic” behind PhoneGap such as setting up the webView and wiring together the view controller and delegates.

4. PhoneGap commands — PhoneGap provides a number of built-in plugins to access native resources like the camera or the address book, this is where you can find the source code…
5. Project Plugins — This is where you would place your own custom plugins since PhoneGap can be easily extended and new features added by extending the PhoneGapCommand class and implementing the objective-c code for the native function you want to expose (see later in the tutorial for how to do this.)




             
            How Does it all Work...?


            PhoneGap works by extending and wrapping common classes of the iOS SDK:
1. The PhoneGapDelegate class extends UIApplicationDelegate and implements theUIWebViewDelegate protocol and is responsible for setting up the application, instantiating the view controller, configuring the views, and performing the delegate functions for the webView.

2. The PhoneGapViewController extends UIViewController and is responsible for responding to view lifecycle methods.

3. The PhoneGapCommand is the base class for all the available PhoneGap API plugins (like the Camera, GPS, and Contacts) and is responsible for providing access to the appDelegate, appViewController, and the webView. This class can be extended to create your own custom plugins.

Comments

Popular posts from this blog

Cordova Plugin Firebase Cloud Messaging For Android

iOS Phonegap app share extension (images) with ionic

Print Hand Plugin With Cordova/PhoneGap For Android.