[AIR for IOS] 越狱版程序自更新

网上有很多的人分享IOS越狱,官方版的程序自更新。但是我还是习惯记录一下。IOS项目的程序更新使用到了itms-services协议,我们并不需要太了解itms-services协议是什么,只需要在服务器配置一个xml 和在 AIR 项目中调用遍可以实现我们想要的功能。
针对以下XML需要改 的地方只是:

  1. 需要更新的ipa包(修改为你的IPA所在服务器路径)
  2. 程序图标 (修改为你项目本身图标)
  3. 程序包名(修改为你项目的包名ID,其实就是-app.xml中的id)
  4. 程序名字(修改为你的程序名字 其实就是-app.xml中的fileName)

首先是需要在服务器配置一个xml:

[code lang=”html”]
<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>https://shadowkong.com/rect/rect.ipa</string>
</dict>
<dict>
<key>kind</key>
<string>display-image</string>
<key>needs-shine</key>
<true/>
<key>url</key>
<!– 程序图标 –>
<string>https://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>https://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>
[/code]

我们假设把这个xml放到 github/recter/plist.xml。
则在 AIR For IOS项目中 在任何需要更新自身程序的地方 调用以下代码:

[code lang=”java”]
flash.net.navigateToURL(new URLRequest(
"itms-services://?action=downloadmanifest&amp;amp;"+
"amp;amp;amp;amp;amp;amp;amp;amp;"+
"amp;amp;amp;url=http://github/recter/plist"));
[/code]

如此便可实现IOS越狱版的程序自更新。

发表评论

邮箱地址不会被公开。 必填项已用*标注