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:
$ mkdir webServer $ cd webServer
Install the sinatra gem
$ gem install sinatra
Create a ruby file,
app.rbwith the following code:
require 'sinatra'
get '/' do
"Welcome to our Enterprise iOS app web server!"
endNow, create an
index.htmlfile that is accessible through the URL:
localhost:[PORT]/app/index.html. To do so, you must first create a
publicdirectory within the
webServerdirectory, and an
appdirectory within
public.
$ mkdir public $ cd public $ mkdir app $ cd app $ touch index.html
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):
<html>
<body>
<a href="itms-services://?action=download-manifest&url=http://yourWebAppName.herokuapp.com/yourManifestFile.plist">Install App</a>
</body>
</html>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 WEBrickwhen 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.rufile with the following contents:
require './app' run Sinatra::Application
a
Gemfilewith the following contents:
source 'http://rubygems.org' gem 'sinatra'
then run
$bundle install, initialize the
webServerdirectory as a git repository, and add all of the files in a commit:
$ git init $ git add . $ git commit -m "Simple web server to serve iOS enterprise apps. Initial commit"
Make sure you have the Heroku Toolbelt installed and set up, and then create your Heroku app:
$ heroku apps:create yourWebAppName
And push it to Heroku:
$ git push heroku master
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.htmlin 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.