Book Image

PhoneGap 3 Beginner's Guide

By : Giorgio Natili
Book Image

PhoneGap 3 Beginner's Guide

By: Giorgio Natili

Overview of this book

<p>You don’t have to know complex languages like Objective C to compete in the ever-growing mobile market place. The PhoneGap framework lets you use your web development skills to build HTML and JavaScript-based mobile applications with native wrappers that run on all the major mobile platforms, including Android, iOS, and Windows Phone 8.</p> <p>"PhoneGap 3 Beginner's Guide" will help you break into the world of mobile application development. You will learn how to set up and configure your mobile development environment, implement the most common features of modern mobile apps, and build rich, native-style applications. The examples in this book deal with real use case scenarios, which will help you develop your own apps, and then publish them on the most popular app stores.</p> <p>Dive deep into PhoneGap and refine your skills by learning how to build the main features of a real world app.</p> <p>"PhoneGap 3 Beginner's Guide" will guide you through the building blocks of a mobile application that lets users plan a trip and share their trip information. With the help of this app, you will learn how to work with key PhoneGap tools and APIs, extend the framework’s functionality with plug-ins, and integrate device features such as the camera, contacts, storage, and more. By the time you’re finished, you will have a solid understanding of the common challenges mobile app developers face, and you will know how to solve them.</p>
Table of Contents (22 chapters)
PhoneGap 3 Beginner's Guide
Credits
Foreword
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Getting started with iOS and Xcode


In order to start to develop apps for iOS devices it's mandatory to have a Mac and to download the iOS SDK and Xcode, both available on the Apple Developer Center http://developer.apple.com. Complete the following steps and if you are using PhoneGap 2.0 run the installer Cordova-2.0.0.pkg available after mounting the Cordova-2.0.0 DMG file locate into the folder /phonegap-phonegap-2.0.0/lib/ios:

  • Install Xcode from the App Store.

  • Install the Xcode command-line tools (Xcode Preferences | Downloads | Components | Command Line Tools | Install).

Once everything is installed navigate to the bin/ios folder of the current PhoneGap installation and launch the ./create tool:

$ cd PHONEGAP_ROOT/lib/android/bin
$ ./create ~/the/path/to/your/source/code/ch01/ios com.gnstudio.samples.cordova.hello HelloPG

In the target folder you'll find the file HelloPG.xcodeproj; when you open the file in Xcode, your project is already set up and ready to be debugged and deployed.

Tip

If you are using a PhoneGap version greater than the 2.0.0 there is no need to mount the mentioned DMG file in the PHONEGAP_ROOT folder. In order to create a project, is enough to go to the PHONEGAP_ROOT/lib/ios/bin folder and run the ./create tool or use the cordova command line utility available as a npm module.

In order to debug the app change the Target in the Scheme drop-down menu on the toolbar to HelloPG (or the current project name) and change the Active SDK in the Scheme drop-down menu on the toolbar to iOS [version] Simulator.

To deploy the app on a physical device: open the file HelloPG-Info.plist; under the Resources group, change BundleIdentifier to the identifier provided by Apple; change the Target in the Scheme drop-down menu on the toolbar to HelloPG (or the current project name); and, with the device connected through USB, click on the Run button in the project window's toolbar.

Note

If you are searching a tool for Objective-C with advanced refactoring features, a better code completion, a great support for Unit tests and powerful code inspection tool you have to consider to buy AppCode from JetBrains , more information is availabl e at http://www.jetbrains.com/objc/.