iOS App Distribution
iOS App 有不少分发方法,她们散落在 Apple 的文档中,并未归总到一处,所以本文对她们进行了总结,方便查阅。
首先我们简单梳理下这些分发方法,然后重点说明下 ipa 文件的安装方法。 Apple 制作的这张表格将分发方法归纳得很全:
Method | Description |
---|---|
App Store | Distributes your app through the App Store, signed with an Apple Developer Program distribution provisioning profile. |
Ad Hoc | Distributes your app to testers with registered devices, signed with an ad hoc provisioning profile. The devices need to be registered in your developer account and are limited to 100 devices per product family per year. If you don’t want to use a portion of these development devices for testing, distribute your app using TestFlight instead. If you are a member of the Apple Developer Enterprise Program, choose this option to test your app. Only members of the Apple Developer Program have access to App Store Connect and TestFlight. |
Development | Distributes your app to testers with registered devices, signed with a development provisioning profile. |
Enterprise | Distributes your app to users in your organization, signed with an Apple Developer Enterprise Program distribution provisioning profile. |
虽然分发方法有很多,但可以分为两类:一类是通过 App Store 分发;另一类则是在 App Store 外分发。通过 App Store 分发时的流程很统一,都是上传应用到 iTunes Connection,等待审核发布,所以没有什么好说的。但是在 App Store 外发布时选择就多样了,我们既可以走像 App Store 分发那样流程的 TestFlight,也可以导出 ipa 文件然后安装。
下面我们介绍在 iPhone 上安装 ipa 的方法:
Install using iTunes
iTunes 12.7 for Mac was released on Tuesday with a major change in the app. Apple has redesign iTunes so that it focuses on sales of music, movies, TV shows, audiobooks, and podcasts. It no longer has an App Store for buying apps for your iPhone or iPad. Therefore, you can no long install your iOS App (.ipa file) through iTunes any longer.
- Download the .ipa file after the build completes.
- Open iTunes, go to App library.
- Drag and drop the downloaded .ipa file into the App library.
- Connect your device to iTunes and go to your device apps.
- Click Install button of the app and click Sync button.
Install using Apple Configurator 2
- Install Apple Configurator 2 on your Mac from the App Store.
- Connect your device to your Mac.
- Open Apple Configurator 2, select your device. If you device doesn’t appear here, please make sure that your device is successfully connected to your Mac.
Install using Xcode
- Connect your device to your Mac.
- Open Xcode, go to Window > Devices .
- Then, the Devices screen will appear. Choose the device you want to install the app on.
- Drag and drop your .ipa file into the Installed Apps.
Install using OTA Deployment
OTA (Over-The-Air) Deployment enables you to install your built apps (ad-hoc build) via HTTPS.
- Download the .ipa file after the build completes.
- Upload the .ipa file to the site you want.
- Create a .plist file for this built application. The .plist file should look like this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
|
- Upload the
.plist
file to the site you want. Make sure this file must be accessed via HTTPS protocol. - Create a webpage embedded the link to the uploaded
.plist
file using specialitms-services://
protocol. See blow example:
1
|
|
使用 OTA 方式部署安装,需要自己架设 Web 服务器,目前市面上也有免费提供此安装服务的产品,如 Fir.im,蒲公英。
如果我们希望自己架设 Web 服务器来提供 OTA 分发,则相应地需要做些配置工作:
HTTPS
保证 ipa 文件是通过 HTTPS 访问,所以网站必须是由 iOS 信任的证书签名的。如果是没有信任锚的自签名证书,并且不能被 iOS 设备验证,那么安装会失败。
Set server MIME types
你也许需要配置你的 web 服务器以便清单文件和应用文件能正确传输。
For the server, add the MIME types to the web service’s MIME types settings:
1 2 |
|
For Microsoft’s Internet Information Server (IIS), use IIS Manager to add the MIME type in the Properties page of the server:
1 2 |
|
同时,如果设备是连接到一个封闭的内部网络,我们必须保证如下访问:
Network configuration requirements
- https://ax.init.itunes.apple.com: The device obtains the current file-size limit for downloading apps over the cellular network. If this website isn’t reachable, installation may fail.
- https://ppq.apple.com: The device contacts this website to check the status of the distribution certificate used to sign the provisioning profile.