网上有很多的人分享IOS越狱,官方版的程序自更新。但是我还是习惯记录一下。IOS项目的程序更新使用到了itms-services协议,我们并不需要太了解itms-services协议是什么,只需要在服务器配置一个xml 和在 AIR 项目中调用遍可以实现我们想要的功能。
针对以下XML需要改 的地方只是: - 需要更新的ipa包(修改为你的IPA所在服务器路径)
- 程序图标 (修改为你项目本身图标)
- 程序包名(修改为你项目的包名ID,其实就是-app.xml中的id)
- 程序名字(修改为你的程序名字 其实就是-app.xml中的fileName)
首先是需要在服务器配置一个xml: - <plist version="1.0">
- <dict>
- <key>items</key>
- <array>
- <dict>
- <key>assets</key>
- <array>
- <dict>
- <key>kind</key>
- <string>software-package</string>
- <key>url</key>
- <!-- 需要更新的ipa包 -->
- <string>http://shadowkong.com/rect/rect.ipa</string>
- </dict>
- <dict>
- <key>kind</key>
- <string>display-image</string>
- <key>needs-shine</key>
- <true/>
- <key>url</key>
- <!-- 程序图标 -->
- <string>http://shadowkong.com/plist/57.png</string>
- </dict>
- <dict>
- <key>kind</key>
- <string>full-size-image</string>
- <key>needs-shine</key>
- <true/>
- <key>url</key>
- <!-- 程序图标 -->
- <string>http://shadowkong.com/plist/144.png</string>
- </dict>
- </array>
- <key>metadata</key>
- <dict>
- <key>bundle-identifier</key>
- <!-- 程序包名 -->
- <string>com.rect.test</string>
- <key>bundle-version</key>
- <string>0.1.0</string>
- <key>kind</key>
- <string>software</string>
- <key>subtitle</key>
- <!-- 程序名字 -->
- <string>TestDemo</string>
- <key>title</key>
- <!-- 程序名字 -->
- <string>TestDemo</string>
- </dict>
- </dict>
- </array>
- </dict>
- </plist>
复制代码 我们假设把这个xml放到 github/recter/plist.xml。
则在 AIR For IOS项目中 在任何需要更新自身程序的地方 调用以下代码:
- flash.net.navigateToURL(new URLRequest(
- "itms-services://?action=downloadmanifest&"+
- "amp;amp;amp;amp;amp;amp;amp;amp;"+
- "amp;amp;amp;url=http://github/recter/plist"));
复制代码 如此便可实现IOS越狱版的程序自更新。
本文来自:http://shadowkong.com/archives/1438
|