Testing iOS (iPhone and iPad)
As mentioned before, you can only develop and test iOS applications on Mac OSX 10.6.7 (Snow Leopard) or greater. Here are the additional requirements for testing and releasing iOS apps (including testing on a device).
- An iOS Developer Program Account ($99/year)
- Xcode with iOS SDK: http://developer.apple.com/xcode/
- A Development Certificate to sign applications for testing on devices
- A Development Provisioning Profile to install on devices for testing
- A Distribution Certificate to sign applications for distribution in the App Store
- A Distribution Provisioning Profile for submission/distribution through App Store
Setting up iOS Developer Program Account
Visit http://developer.apple.com/programs/ios/ and click "enroll now". During the process, you can select if you'd like to enroll as a company or as an individual. Enrolling as a company will generally make more sense as it allows multiple users to be associated with one account, but it will likely take a few days for Apple to verify information about the company and approve the account. If you enroll as a company, you won't be required to pay the $99 fee until your account has been approved. Individuals should be prepared to pay the fee at the end of the signup process.
Once your account is created, you'll have access to two important tools for iOS development and deployment: iOS Provisioning Portal and iTunes Connect.
Setting up Xcode and iOS SDK
Although most of the development time for uMobile takes place in your own code editor and Titanium Developer, you'll need the iOS SDK to compile apps and will need Xcode occasionally to manage other data. You'll need to be enrolled in the iOS developer program (or Mac OSX Developer Program) before you can download Xcode. Visit https://developer.apple.com/xcode/ to download the IDE bundled with the iOS SDK. The download is about 4.6 Gigs, so be prepared to wait a while. Once Xcode finishes downloading, install it, and you now have the iOS SDK ready to go.
Creating iOS Certificates and Provisioning Profiles
The creation and management of certificates and provisioning profiles can be confusing, but is a necessary part of the process to be able to test on real devices and ultimately submit your app to the App Store. A simple way to think about certificates and profiles is that a certificate pertains to the integrity of one or many applications, whereas a profile pertains to the deployment context (eg. Device, App Store Distribution, Ad-Hoc) of one or many applications. Here are some examples of profiles:
- Jeff Cross Development Certificate - Personal certificate for signing apps to test.
- Unicon, Inc. Distribution Certificate - iOS Account-wide certificate for signing apps for distribution
- Team Provisioning Profile - A shared profile for all users under the same iOS Developer Program account.
- Jeff Cross iPad Profile - A profile for a specific device.
- Sakai11 Distribution Profile - A profile used for packaging an app for distribution
For now, you can just worry about settings up a development certificate and development profiles, but eventually you'll need to create a distribution certificate, and separate distribution profiles for each app you want to distribute.
The process for managing certificates and profiles is covered in good detail here: [http://developer.apple.com/library/ios/#documentation/Xcode/Conceptual/iphone_development/128-Managing_Devices_and_Digital_Identities/devices_and_identities.html|http://developer.apple.com/library/ios/#documentation/Xcode/Conceptual/iphone_development/128-Managing_Devices_and_Digital_Identities/devices_and_identities.html]. Follow the steps outlined there to set up your team for iOS development.
Testing in iOS Simulator
Assuming you've already set up your project in Titanium Developer, you just need to open Titanium Developer, select your project on the left, click the "Test and Package" tab, click the "Run Emulator" tab, select iPhone (default), and then click the Launch button.
The iOS Simulator should open quickly with your app running.
Testing on iOS Device
To test on an iOS device, you first need to have your development certificates and provisioning profiles all squared away on your computer and device, as outlined above.
- Just plug your device into your Mac's USB port
- In Titanium Developer, Select your project in the left menu
- Click the "test and package" tab
- Click "Run on Device" and select iPhone (default)
- Select the SDK version you'd like to use
- Select the development certificate you've installed
- Select the provisioning profile with which you'd like to install your app
- Hit the "Install Now" button
This should automatically build your app, and install it on your app through iTunes. However, sometimes it will build the app and install it to iTunes but not actually deploy to your app. In this case, you'll need to follow these steps after the application is done building:
- Open Xcode, and then from the Window menu select "Organizer".
- Select the device you'd like to test with from the left-hand menu
- Open iTunes, select "Apps" from the left side to display all of your iOS apps.
- Find the newly-built app, right click on it and select "Show in Finder". This will open a finder window to the containing folder of your app
- Drag the app from Finder into the Applications list in Xcode organizer.
This will manually install the app on your device.
Now the app is on your device and ready to test.
Leave your device connected to your computer, and watch the "Console" tab in Xcode organizer to see log statements from your app.