Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 35 Next »

Setup iOS Development Environment

THIS DOCUMENTATION IS OUTDATED AND IS CURRENTLY BEING UPDATED.

Requirements

  1. Apple OSX development environment.
  2. Download XCode 4.6.
  3. Download PhoneGap 2.50.
  4. Download & run uMobile 1.1RC1 quickstart.
  5. Download & install node.
    1. Node is used to automate the build process for our JavaScript, HTML and CSS assets.
    2. Node is installed locally and is leveraged for convenience.
    3. Node v0.8.12 is recommended for this documentation.

Getting Started with iOS

The PhoneGap website has an excellent iOS start up guide. It is recommended but not mandatory that you walk through their startup guide before continuing to familiarize yourself with the overall process.

Creating the Project

Extract PhoneGap

  1. Navigate to the folder where you downloaded PhoneGap 2.50. Find the phonegap-2.5.0.zip file and extract its contents.
  2. Expand this folder and navigate to phonegap-2.5.0 > lib > ios directory.
  3. The ios directory is where we will be working to create a new project.

Open Terminal

  1. Open a new Terminal window.
  2. In the Terminal window, navigate to the ios > bin directory from the extracted PhoneGap code base.

Create a Project from the Terminal

There are 3 ordered, required parameters for creating a project from the command line. For more detailed information on these parameters visit the PhoneGap iOS start up guide.

  1. Project LocationThis is the directory where the Xcode project and files for the application will be located.
  2. Package Name: This is the reverse domain name App ID that is created via the Apple Provisioning Portal. Note: The package name is specific to your institution.
  3. Project NameThis is the name of the actual project.

To create a project

  1. In the Terminal window with ios > bin as your current directory, enter the 3 required parameters with the create command.

    ./create ~/Documents/umobile-phonegap-ios org.jasig.umobile.phonegap.ios uMobile
  2. A complete and ready to launch project will be created under the directory specified.
     
  3. Navigate to the www directory. Open the directory and delete all of the folder contents. Do not delete the www directory itself. The www directory is the folder that houses our custom HTML, CSS and JavaScript implementation. In this step, we are simply removing stubbed files provided by the PhoneGap code base.

Adding the uMobile Source

  1. In a Terminal window, navigate to your project location. For this tutorial, our project is housed under the Documents > umobile-phonegap-ios directory.
  2. From this directory, checkout the uMobile source code.

    git clone git@github.com:Jasig/umobile-app-phonegap  umobile-ui
  3. ...

 

 

 

Creating the Project

A completed example of an XCode project configured to run the uMobile PhoneGap implementation is available on github.

  1. Check the uMobile source out into a new project directory.
     

  2. Navigate to umobile-ui/config/js.
    1. uMobile currently supports three different authentication strategies: CASLocal & Mock.
    2. Each strategy has a cooresponding configuration file under the umobile-ui/config/js directory (i.e., cas.jslocal.js and mock.js).
    3. Choose one of the three authentication strategies. For this documentation, we will use cas.js.
    4. Open cas.js.
      1. Set config.uMobileServerUrl to http://localhost:8080.
      2. Set config.loginFn to casLogin.
      3. Note: There are bugs with the current login functionality. Only view the portal using the guest layout. This is being addressed.
  3. Run the build process for the uMobile source code. The build process configures the uMobile source code with the necessary dependencies needed to run in a given environment. Currently, the uMobile project supports Android, iOS and Web platforms. Once the build completes a www directory will be added to the umobile-ui directory. The www directory houses the production ready code base to be used with the PhoneGap wrapper. Please see the documentation on the uMobile HTML5 build for more information on configuring the build script.

    cd umobile-ui sudo npm install
    grunt --environment=ios --config=cas --build=prod

     

  4. Drag the production-ready www directory from your finder window to the XCode uMobile project. When done for the first time, XCode will ask you to create a workspace before including the www directory. For the purpose of this project, we created a umobile workspace.
      
  5. Choose options for adding the www directory to the project.
     
  6. Configure cordova.plist.
    1. In XCode, under the Project Navigator, navigate to uMobile > Supporting Files > Cordova.plist.
    2. Under the Root Key:
      1. Set OpenAllWhitelistURLsInWebView to Yes.
    3. Under the ExternalHosts Key:
      1. Add the hostname, any authentication servers and any other servers hosting uMobile resources.
      2. If you're working with the uMobile quickstart, you can just add localhost.
    4. Under the Plugin Key:
      1. Plugin: SesssionTracking
      2. Type: String
      3. Value: SessionTracking


  7. Add SessionTracking Plugin files into the Plugins folder:
    1. SessionTracking.h
    2. SessionTracking.m


  8. Download MainViewController.m
  9. Navigate to uMobile > Classes > MainViewController.m.
  10. Replace MainViewController with the downloaded version.
  11. Set the scheme at the top of the project to iPhone 6.1 Simulator and run the project!

Debugging

uMobile logs helpful events and errors. You can access the log by viewing the console output.

  • No labels