Issue 88 March 18 2010

Getting Started on the iPhone
How do I build an iPhone application with the revMobile Pre-alpha?

by Ben Beaumont

This article is reprinted from the lessons area of our tutorials site. If you would like to see more lessons like this please visit lessons.runrev.com!

This lesson will show you how to use the Mobile Plugin stack provided as part of the revMobile pre-alpha to create, test and deploy an iPhone application.

Before you can build iPhone applications, you'll need to have the iPhone SDK installed on your machine. You can register as an iPhone developer and get the SDK here: http://developer.apple.com/iphone. For more information on how to get started with iPhone development see this lesson: How Do I Become An iPhone Developer.

Load up the revMobile Plugin stack in Revolution

Media_1267710144525

The revMobile Plugin stack is provided to make building and testing iPhone applications as easy as possible. You'll need to load up the stack in revEnterprise 4.0, or one of the developer previews of 4.5. We've been using 4.5.0-dp-2 with it. It will also work in revStudio 4.0. The revMobile Plugin can be found in the pre-alpha distribution, named revMobilePlugin.rev.

Choose the stack you want to run on the iPhone

Media_1267718116662

Before you can test and deploy your application, you'll need to have a saved stack that will be used as the main window. You can either create a new stack or use an existing one. iPhone screens are 320px by 480px, with a 20px menu bar, so its best to make your stack 320px by 460px. Once you've loaded the stack up in Revolution, you can create an iPhone project using the the "+" button in the top right of the mobile plugin window.

Enter Application Details

Media_1267711656971

Before starting the application, enter some information about it into the fields on the card.

1. The drop-down menu at the top controls which version of the iPhone OS should be loaded into the simulator for testing. It has no effect when deploying.

2. The Name is used as the filename of the application bundle produced.

3. The BundleID is put into the Info.plist file for the application. It should typically by in the format com.<yourcompany>.<yourapp>

4. The Icon can be any PNG image. The icons are displayed at 57px by 57px, so this is the ideal size to choose, otherwise it will be scaled.

5. The profile is only needed for deployment on a real device. If you have one installed, choose it from the drop-down list.

The files list allows you to include other files in the application bundle. They are copied in next to the stack itself.

Testing the application using the iPhone Simulator

Media_1267712155073

When you install the iPhone SDK on your machine, you'll get an iPhone simulator application, which allows you to debug your iPhone apps easier than using a real device. The revMobile plugin automatically finds and launches the simulator for you when you click the "Start" button. Clicking the "Stop" button will close your iPhone application.

Creating the deployment bundle

Media_1267712719875

Once you have registered appropriately as an iPhone developer and setup your certificate and obtained a provisioning profile, you can deploy your application onto a real iPhone or iPod touch. To do this, simply choose your provisioning profile from the drop-down list, and click the deploy button. The application bundle should be created on your desktop. For more information on registering as an iPhone developer see the lesson here: How Do I Become An iPhone Developer.

Installing your Provisioning Profile onto the Device

Media_1267713128744

When you connect the iPhone to your machine, the Xcode organizer should automatically jump up. If you haven't already done this, you'll need to install your provisioning profile onto the iPhone before you can deploy the application. This is done by dragging the profile onto the device from the "Provisioning Profiles" section of the Xcode organizer. Note here that we are testing with an iPod Touch, which runs the same OS as the iPhone. The process is the same for both devices.

Deploying the application

Media_1267713236559

Once you've got this far, deploying the application is a simple matter of dragging the bundle from your desktop into the "Applications" field for the device in the Xcode organizer.

About the Author

Ben Beaumont is Product Manager for RunRev Ltd.

Main Menu

What's New

Get revMobile Today