As you're developing or customizing uMobile, you'll want to test regularly to make sure your app is functioning as expected. The processes and requirements for testing on iOS and Android are very different.
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.
Packaging iOS For Distribution
Packaging for distribution involves steps required for testing on a device, but adds some additional steps:
- Setting up the app in iTunes Connect
- Creating a new Bundle ID
- Generating a Distribution Profile
- Validating and submitting the app binary through Xcode
Setting up Apps in iTunes Connect
iTunes Connect is where you manage your App Store apps, and information associated with those apps. Features of iTunes Connect:
- View sales and trends of existing apps
- Manage users who can access iTunes Connect for this account (for company accounts, not individual)
- View contracts and financials
- Manage applications (this is where you upload applications and manage versions of applications)
When you're nearing the time to submit your app for review, you should start the process of submitting your app in iTunes connect. You can start the process even if you're not quite ready to release your app, so that when the app IS ready, all you have to do is upload your binaries.
The process is mostly self-explanatory if you visit itunesconnect.apple.com and click "Manage Your Applications." However, there's a useful guide from Apple here (must login to access): http://itunesconnect.apple.com/docs/iTunesConnect_DeveloperGuide.pdf
Once you've set up your app, and your iOS app is fully-tested and ready to submit, you'll need to log into iTunes Connect, Manage Your Applications, and indicate that your app is ready for submission so that the status becomes "Waiting for Upload." At this point, you should have created a distribution profile for your app in the iOS provisioning portal.
Steps for compiling and submitting the app:
- In Titanium Developer, navigate to <project> > Test & Package > Distribute > iPhone
- Select the iOS SDK version you'd like to target
- Select your distribution certificate (if it doesn't show up, try re-downloading from the iOS provisioning portal, or set it up if it hasn't been set up yet).
- Select a distribution location. For example, a folder called "release" in your project folder.
- Select the distribution provisioning profile. You MUST select the distribution profile that's been associated with the app you're submitting.
- Click "Package"
When the process in Titanium is done, it will automatically open Xcode Organizer, focused on the app that was just packaged.
In Xcode, to complete the final submission of the app:
- Select the most recent archive (the packaged version of your app) from the list on the right-hand side.
- Click the "Validate" button in the top right part of the window.
- You'll be prompted to select the profile to use for validation.If validation passes, click the "Submit" button to upload your app to the App Store.
- If upload succeeds, your app status will change to "Waiting for Review," until they start reviewing the app.
If you run into issues during this process, try copying whatever error message you see, and searching for it in the Titanium Developer Q&A site: http://developer.appcelerator.com/questions/
http://developer.appcelerator.com/questions/The amount of time it takes to review apps is unpredictable, but can take anywhere from a week upwards. Make sure to allow time for multiple review rounds for your release, in case the app is rejected the first time.
Testing Android
To test on the Android emulator or an Android device, these are the only requirements:
- Install the Android SDK: http://developer.android.com/sdk/installing.html
- Enable USB Debugging on your device in Settings > Applications > Development...and of course you'll need to plug the device into your computer via USB.
You can deploy your app to the emulator or device through the Titanium Developer GUI. Just navigate to <project> > Test & Package > (Run Emulator OR Run on Device) > Android. When running in the emulator, you can choose the Android OS version, and screen resolution. Whichever version of Android you want to test with, select that version with APIs included (eg. APIs 2.2), so that the maps functionality will work.
It's recommended to test on lower resolution screens in the emulator so that the emulator will be faster, and so you'll see how the app looks on a smaller screen
Fastdev
Titanium has recently released a tool called Fastdev, which streamlines testing in the Android emulator (and eventually the iOS simulator as well). http://wiki.appcelerator.org/display/guides/Fastdev+Reference+for+Android
Fastdev launches a server to serve your javascript assets to the emulator, rather than packaging them all and deploying them directly to the emulator. As you edit your Javascript, the emulator app reflects your changes immediately. However, most often, you'll need to restart the app in the emulator to see changes take effect. This is much quicker than re-compiling the app entirely though. Here's how to launch Fastdev from command line
cd ~/ProjectRoot
(Contains Resources, build, etc)titanium fastdev start
(Make sure titanium is set up as an alias on your machine: http://developer.appcelerator.com/doc/mobile/android/module_sdk)- In a new shell window:
titanium run --platform=android
Application should start in emulator. If an emulator doesn't appear, start the Fastdev server (step 2), and then launch the app from Titanium Developer (it will still use the Fastdev server).
When you've made changes to your app and want to see them in the emulator, just type the command: titanium fastdev restart-app
which will quickly exit and reopen your app, using files served from the Fastdev server.
Android Device Debugging with DDMS
DDMS, or Dalvik Debug Monitor is an interface that allows monitoring of connected device or emulator logs, so you can see statements from your application as you test on a phone or emulator. If you're testing through Titanium Developer, you'll see the emulator logs already, so DDMS isn't really necessary. However, when testing on your device, DDMS is invaluable. To launch DDMS, just navigate to <android sdk>/tools in your shell, and excute ddms
. This will open a window which will show a list of available devices/emulators on the left. Just select the one you want to monitor, and its logs will appear below. You can also view other information about the device and active threads in the top right of the window.
http://developer.android.com/guide/developing/debugging/ddms.html