Friday, January 31, 2014

Finally in PhoneGap: Build and install iOS apps from the command line

For some time now I've been able to fully develop PhoneGap Android Apps on Windows without ever opening Eclipse, but I couldn't say the same about iOS and XCode. Until today. Here's the recipe that let's me develop in Emacs and shell without ever having to open up XCode:

Environment:

  • XCode 5.0.2. (You need the guts of XCode for this to work, even if you never open it up.)
  • PhoneGap 3.3.0-0.19.4. Install it: sudo npm install -g phonegap
  • ios-deploy 1.0.4. Install it: sudo npm install -g ios-deploy
  • Emacs

Using Emacs I edit various files under www. When I'm ready to test on my device, I enter the following from a shell:

 phonegap build ios ;  ios-deploy -b platforms/ios/build/device/MyApp.app

A few minor notes: (1) Technically, I could run phonegap install ios, but that command was actually hanging for me. (2) I trimmed down the platforms/ios/cordova/build script a bit. It was building an emulator version of the app that I don't use, so I removed that line. That way, the build and install loop happens that much faster.

I still had to crack open XCode to Archive and generate an actual .ipa file. But given how infrequently I need to do this, I'm OK with that.

Hurray for command lines and emacs!

No comments:

Post a Comment