Setup iOS Development Environment
Requirements
- Apple OSX development environment.
- Download XCode 4.6.
- Download PhoneGap 1.70.
- Download & run uMobile 1.1RC1 quickstart.
Creating the Project
- Open XCode. Choose File > New > Project.
- Select Cordova-based Application from the list of templates.
- Enter the following options on the next screen:
- Product Name: uMobile
- Organization Name: Your organization's name
- Company Identifier: org.jasig.umobile.phonegap.ios
- Check: Use Automatic Reference Counting
- Choose a location for your project.
- Disable Automatic Reference Counting in the build. To do this, select the uMobile target in the main project view, click on the "Build Settings" tab at the top, and enter reference in the search bar. Select the "Objective-C Automatic Reference Count. . ." property and set it to No.
Check the uMobile source out into the new project directory.
git clone git@github.com:Jasig/umobile-app-phonegap umobile-ios
Copy the iPhone-specific Cordova Javascript file to "cordova.js".
cd umobile-ios cp www/lib/external/cordova-iphone-1.7.0rc1.js www/lib/external/cordova.js
Open the coned GitHub clone in Finder, then drag the www folder into the top of the XCode project with your mouse.
Configure cordova.plist by setting OpenAllWhitelistURLsInWebView to true. Next, add the hostname of your uMobile server, any authentication server, and any other servers hosting uMobile resources to ExternalHosts. If you're working with the uMobile application server quickstart, you can simply add localhost to the list. Under Plugins add Key: SessionTracking, String: SessionTracking.
- Add SessionTracking Plugin files into the Plugins folder: SessionTracking.h and SessionTracking.m
- Configure www/config.js. If you're working with the quickstart, set the value of config.uMobileServerUrl to http://localhost:8080.
- Overwrite the file /Classes/MainViewController.m with this one: MainViewController.m
- Set the scheme at the top of the project to iPhone 5.1 Simulator and run the project!
Debugging
uMobile logs helpful events and errors. You can access the log by viewing the console output.