不通过AppStore,在iOS设备上直接安装应用程序的原理

移动开发 iOS
通过itms-services协议,可以通过safari浏览器直接在iOS设备上安装应用程序。利用这种方式,只要在内网布置一个服务器,测试人员只需要通过测试设备的safari浏览器访问特定的url既可以实现安装,然后测试了。

通过itms-services协议,可以通过safari浏览器直接在iOS设备上安装应用程序。利用这种方式,只要在内网布置一个服务器,测试人员只需要通过测试设备的safari浏览器访问特定的url既可以实现安装,然后测试了。(PS:越狱设备也可以)

itms- services协议需要一个plist配置文件。如果要实现上面图示的功能,需要的文件有:一个ipa文件,一个plist文件,一个html文件和一 个图片文件。其中,最主要的,就是plist文件。通过shell脚本,我们可以让其自动为我们生成plist文件和html文件,并且在xcode工程 中的ipa文件和程序图标文件复制一份,放到一起。

《xcode自动打ipa包脚本》学习地址:http://webfrogs.me/2012/09/19/buildipa/

plist文件范例如下:

  1. <?xml version="1.0" encoding="UTF-8"?>   
  2. <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">   
  3. <plist version="1.0">   
  4. <dict>   
  5.    <key>items</key>   
  6.    <array>   
  7.        <dict>   
  8.            <key>assets</key>   
  9.            <array>   
  10.                <dict>   
  11.                    <key>kind</key>   
  12.                    <string>software-package</string>   
  13.                    <key>url</key>   
  14.                    <string>ipa包的下载地址,如:http://www.tammy.com:450/static/ios/(targetname)_(version)_build(buildversion)_yyyyMMdd.ipa</string>   
  15.                </dict>   
  16.            </array>   
  17.            <key>metadata</key>   
  18.            <dict>   
  19.                <key>bundle-identifier</key>   
  20.                <string>应用程序中的<span style="font-family:FangSong_GB2312">bundle-identifier</span><span style="font-family:FangSong_GB2312"></string></span>   
  21.                <key>bundle-version</key>   
  22.                <string>版本号</string>   
  23.                <key>kind</key>   
  24.                <string>software</string>   
  25.                <key>subtitle</key>   
  26.                <string>子标题</string>   
  27.                <key>title</key>   
  28.                <string>软件名称</string>   
  29.            </dict>   
  30.        </dict>   
  31.    </array>   
  32. </dict>   
  33. </plist>   

html文件范例如下:

  1. <span style="font-size:12px"><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">   
  2. <html>   
  3. <head>   
  4.   <meta http-equiv="Content-Type" content="text/html; charset=utf-8">   
  5.   <meta http-equiv="Content-Style-Type" content="text/css">   
  6.   <title>测试包安装</title>   
  7. </head>   
  8. <body>   
  9. <br>   
  10. <div style="position:absolute;left:200px" width=400><a href="../index.html">返回</a></div>   
  11.     <h1 align="center">开发版(TRUNK)</h1>   
  12.     <table align="center" border=1 width=400>   
  13.     <tr height=60>   
  14.         <th colspan=2><h2>标题</h2></th>   
  15.     </tr>   
  16.     <tr height=60 align="center">   
  17.         <td width=200><a href="itms-services://?action=download-manifest&url=</span><span style="font-size:10px"><span style="font-family:FangSong_GB2312">http://www.tammy.com:450/static/ios/****.plist</span><span style="font-family:FangSong_GB2312">"><h2>Install</h2></a></td></span></span><span style="font-size:12px">   
  18.         <td width=200><a href="</span><pre name="code" class="html" style="color:rgb(34,34,34); line-height:22px">http://www.tammy.com:450/static/ios/(targetname)_(version)_build(buildversion)_yyyyMMdd.ipa</pre>"><h2>Download</h2></a></td></tr>    </table><br></body></html> 

不通过App Store,直接安装应用程序的实现步骤:

1、设置签名

利用developer profile或者adhoc distribution profile签名app,注意,不能使用distribution profile方式签名;个人开发者证书只能在100个设备中实现无线安装。

2、生成arichive

菜单:product->archive,完成后可以在organizer中看到生成的arichive。

3、生成ipa

选择刚刚生成的arichive,点击“Distribute...",弹出如下图界面,选择第二个,点“next”,设置相关参数,一 定要勾选“save for enterprise distribution”。application url,是生成的ipa在服务器的位置;title是安装过程中出现的标题;large image url 和 smal image url是安装过程中出现的图标。点击保存,将生成两个文件:***.ipa和***.plist。

4、服务器部署

将生成的***.ipa和***.plist文件部署到服务器,同时在服务器生成一个html文件,目的是点击后打开一个链接,这样ios设备就会执行指令自动安装app了。要打开的链接内容如下:

itms-services://?action=download-manifest&url=http://www.tammy.com:450/static/ios/****.plist

责任编辑:闫佳明 来源: mcaidb.cn
相关推荐

2011-12-29 11:13:58

移动Web应用程序标准

2009-05-25 19:15:56

WinCE应用程序flash设备

2022-02-20 20:09:38

BottlesLinuxWindows

2011-04-13 15:09:06

JavaBlackBerry

2018-10-25 15:13:23

APP脱壳工具

2013-01-14 12:10:46

firefox osfirefox os

2011-10-12 11:24:44

AndroidPC

2019-08-13 15:39:27

Linux应用程序

2018-03-28 08:30:01

Linux仓库应用程序

2021-05-11 09:42:04

CI校验前端git config

2011-11-23 10:06:32

Azure微软移动应用

2009-08-05 09:53:42

2022-12-25 18:03:13

Debug原理软件

2018-08-15 15:50:03

Windows 10存储空间应用程序

2021-03-09 11:09:10

LinuxWindows应用程序

2023-09-23 15:52:21

Linux白板应用程序

2019-12-25 14:00:53

Linux安卓 8.1 Oreo应用程序

2018-04-23 14:05:06

LinuxUbuntu 17.1AWFFull

2011-06-20 10:27:24

Mini2440 Qtopia Qt

2014-04-02 09:56:13

iOS应用减小安装包
点赞
收藏

51CTO技术栈公众号