phonegap snippets

Running a Phonegap App in a Specific Version of iPhone

Tagged phonegap  Languages bash


cordova emulate ios --target="iPhone-4s"
cordova emulate ios --target="iPad-Air"
cordova emulate ios --target="iPhone-6"
cordova emulate ios --target="iPhone-6-Plus"


phonegap run ios --target="iPhone-4s"
phonegap run ios --target="iPad-Air"
phonegap run ios --target="iPhone-6"
phonegap run ios --target="iPhone-6-Plus"

Phonegap Autorotate

Tagged phonegap  Languages objectivec

In MainViewController#shouldAutorotateToInterfaceOrientation return YES:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
    // Return YES for supported orientations
    return YES; //[super shouldAutorotateToInterfaceOrientation:interfaceOrientation];

How to Debug Phonegap Applications With Safari's Remote Debugger

Tagged safari, phonegap  Languages 
  1. On your iPhone/iPad: Enable Web Inspector . Open “Settings” → “Safari” → “Advanced”.
  2. On your desktop/laptop: Enable Developer tools in Safari. Open “Preferences” → “Advanced” check “Show Develop menu in menu bar”.
  3. Connect your iPhone via USB to your desktop/laptop.
  4. Start the application on your iPad/iPhone via XCode.
  5. On your desktop/laptop: Open the Safari Web Inspect debugger. Go to “Preferences” → “Your phone” → “index.html”.

You can automate the last step by using applescript to open Safari's Web Inspector.

Note: Use CMD+R to reload index.html.

How to hide the status bar in a Phonegap iOS app

Tagged ios, phonegap, statusbar  Languages 

To hide the status bar in a phonegap project:

  1. Double click on your project, or .plist, in XCode
  2. Select the tab named "Info"
  3. Add a new property by selecting an item in the list and then clicking the plus sign
  4. Name the property "View controller-based status bar appearance"
  5. Set the property value to "NO"


  1. Select the tab named general
  2. Check the "Hide status bar" located under "Deployment Info"


How to use Font Awesome in iOS/Phonegap apps

Tagged phonegap, fontawesome  Languages 

First, install Font Awesome:

  1. Download the latest Font Awesome version
  2. Double-click fontawesome-webfont.ttf and install it on your laptop/desktop (optional)
  3. Copy fontawesome.css to www/css
  4. Remove the references to font files in fontawesome.css, i.e. remove @font-face declaration

Then in Xcode:

  1. Copy fontawesome-webfont.ttf into "Your Project/Resources/fonts/fontawesome-webfont.ttf"
  2. Add Font Awesome to the .plist file by selecting the "Info" tab
  3. Add a new property named "Fonts provided by application" and set the value to "fontawesome-webfont.ttf"

Clean and build your project. Font Awesome is now ready to be used.

Phonegap example:

<i class="fa fa-cog"/>