Thoughts on development, design and the world we live in.

Enterprise iOS Distribution

By glenna in Apple, iOS, iPad, iPhone, Mobile, Objective-c, Web Development. Posted on January 14th

With an Apple Enterprise Account, iOS applications may be distributed without the tedious UDID provisioning required for iOS apps that are destined for the App Store.  This lack of provisioning makes over-the-air distribution practical with the very simple user experience of clicking a link on a web page to trigger a download and install of a native iOS application.  Of course, that page needs to be only accessible to internal users in order to comply with Apple’s Enterprise license.

Over-the-Air Distribution with Sinatra and Heroku

This post will walk through creating a simple web server using Sinatra and Heroku to distribute Enterprise iOS apps.

In the command line, create a directory and change into it:

Install the sinatra gem

Create a ruby file, app.rb  with the following code:

Now, create an  index.html file that is accessible through the URL: localhost:[PORT]/app/index.html . To do so, you must first create a  public directory within the  webServer directory, and an app directory within  public .

In  index.html , add the following code (Please note, that you must supply the URL to your application’s manifest file.  See this screenshot for reference):

And finally, add your app’s manifest and .ipa file to the public directory.

Now, in the command line, start your web server by running the command  ruby app.rb . You will see something like  == Sinatra/1.3.3 has taken the stage on [PORT] for development with backup from WEBrick when your server is ready for use.

Go to a web browser and go to  localhost:[PORT]/ . The web page should display “Welcome to our Enterprise iOS app web server!”. Then navigate to  localhost:[PORT]/app/index.html , and you should see a web page with a link, “Install App”.  You can click on the link, but it won’t do anything, because we haven’t pushed to Heroku yet!

Now, to get the app working on Heroku, you need to create a config.ru  file with the following contents:

Gemfile  with the following contents:

then run  $bundle install , initialize the webServer directory as a git repository, and add all of the files in a commit:

Make sure you have the Heroku Toolbelt installed and set up, and then create your Heroku app:

And push it to Heroku:

When the last command has finished, navigate to  yourWebAppName.herokuapp.com/ in a web browser and verify that the web page says “Welcome to our Enterprise iOS app web server!”

On your iOS device navigate to  yourWebAppName.herokuapp.com/app/index.html in a mobile browser, verify there is a link that says “Install App”, click the link and you should be prompted with a dialog that says “yourWebAppName.herokuapp.com/ would like to install EnterpriseHelloWorld” with action “Install”. Click “Install” and your application will begin downloading and installing!

Note: this post does not address how to limit access to only people in your company, which can be done through standard web techniques.


Post a Comment

Your email is never shared. Required fields are marked *