Ad-Hoc iOS App Distribution

14 Oct 2022

Ad-Hoc iOS App Distribution Notes

#Ad-hoc iOS distribution.

Ad hoc distribution lets developers install internal builds of iOS apps on up to 100 registered devices of a type per year. My clients mostly run video software on iPhones and iPads. This page contains notes I used when adding devices and distributing apps to beta users.

#Register a device

Devices are added to your account at https://developer.apple.com. In order to add a device, you need its UDID. The UDID is different from the Serial Number or IEMI. There are several ways of obtaining the UDID. I use Device Manager on Windows 10 and Finder on macOS.

#Getting a UDID on Windows

  1. Connect your iOS device to a Windows machine's USB port
  2. Open Device Manager
  3. expand "Universal Serial Bus devices"
  4. get the properties for "Apple Mobile Device USB composite Deice"
  5. go to the "Details" tab
  6. select "Device Instance path" Windows Device manager UDID

 

#Getting a UDID on macOS

  1. Connect your iOS device to your mac's USB port
  2. Open Finder
  3. Select your device on the left, macOS Finder device
  4. The device name is displayed at the top. Click at it to get the UDID. macOS Finder UDID

 

#Adding to your dev pool

Log into your developer account at Apple and add to the device list

 

#Generate .ipa With XCode

  1. In your XCode window change the target to Any iOS Device (arm64) Generate IPA file

 

  1. Open the Product menu and select Archive. This tells XCode to build an archive for distribution.
    Generate IPA file This may take awhile.

 

  1. When the archive is ready, XCode will open a dialog box listing the archives it has created. Select the Archive you just created and press the 'Distribute App' button. XXX

 

  1. In the "Select a method of distribution" dialog box select 'Ad Hoc' and press Next XXX

 

  1. In the "Ad Hoc distribution option:" dialog box, set the following values.

 

  1. In the "Distribution manifest information:" dialog set the name and URLs for each field. In my case, I have the following values.
  1. In the "Re-sign" dialog box select 'Automatically Manage Signing' and press Next XXX XCode will connect with Apple's servers to sign the distribution files. This may take a long while.

When it finishes, it will list information about the App. Press Export to select the output folder location.

After exporting the app, you'll have a folder containing the files for distribution. Transfer the generated files to your webserver for distribution. On your server, you'll need to make sure names match the files mentioned in manifest.plist.

 

#Ad-Hoc Web Server Deployment

You can use any web server to deploy the app. For simple deployments, I just use Python 3.

A quick and dirty web server with SSL can look like this:

from http.server import HTTPServer, BaseHTTPRequestHandler, SimpleHTTPRequestHandler
import ssl

httpd = HTTPServer(('0.0.0.0', 3000), SimpleHTTPRequestHandler)
httpd.socket = ssl.wrap_socket (httpd.socket,
        keyfile="../privkey.pem",
        certfile='../cert.pem', server_side=True)

httpd.serve_forever()

Use <a href="itms-services: to create a link to download your app to an iOS device.

<!DOCTYPE html>
<html>
	<head>
		<title>Test Mobile Apps</title>
	</head>
	<body>
		<p>Test Video Stream App</p>
		<a href="itms-services://?action=download-manifest&url=https://www.greggallardo.com/apps/fxvs/manifest.plist">Install App</a>
	</body>
</html>

The directory structure for this server looks like this:

deploy@bossy:~/ios$ find .
.
./server.py
./privkey.pem
./server
./server/index.html
./server/apps
./server/apps/fxvs
./server/apps/fxvs/facex_logo_75.png
./server/apps/fxvs/Packaging.log
./server/apps/fxvs/ExportOptions.plist
./server/apps/fxvs/manifest.plist
./server/apps/fxvs/DistributionSummary.plist
./server/apps/fxvs/facex_logo_512.png
./server/apps/fxvs/FXVideoStreamer.ipa
./cert.pem