·您现在的位置: 云翼网络 >> 文章中心 >> 网站建设 >> app软件开发 >> IOS开发 >> IOS应用程序升级

IOS应用程序升级

作者:佚名      IOS开发编辑:admin      更新时间:2022-07-23
IOS应用程序升级流程介绍:IOS手机端应用程序需要升级时,打开服务器端html文件(本文为ucab.html文件)-》点击在线安装-》打开plist文件(本文中为ucab.plist文件)-》plist文件中存储有应用程序升级包的地址。(本文为:http://192.168.1.126:8088/netcrm/ucab.ipa),这个地址是在打包时填写的application URL值。通过升级包地址访问升级包,提示安装升级。 分步介绍: 一、准备工作 1、打包用的企业级证书mobilePRovision文件,证书制作在这里就不罗嗦了。 2、应用升级所需要的服务器端html文件。      应用升级所需要的服务器端html文件,新建一个html文件(本文中为ucab.html),代码如下:
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5. <title>企业通讯录</title>
  6. <script type="text/javascript">
  7.                 function openurl(url){
  8.                         window.self.location=url;
  9.                 }
  10.         </script>
  11. </head>
  12. <style type="text/CSS">
  13. html,body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,
  14. fieldset,legend,input,button,textarea,select,p,blockquote,th,td,span,frame,iframe {margin:0;padding:0;}
  15. .outbox{ margin:0; width:100%; height:1260px;}
  16. .box02 {  margin: auto auto; width:524px; height:81px; text-align:center;}
  17. .button{ margin: 80px auto 0 auto; width:458px; height:107px;}
  18. </style>
  19. <body>
  20. <div class="outbox" style="border:1px solid  #dadfe3;" >
  21.   <div class="box02" style=" margin-top:300px; width:650px; height:81px"><label>
  22.         <font style="font-size: 50pt">企业通讯录</font></label></div>
  23.   <div class="button" style="width: 666px; height: 152px" >
  24.         <p align="center"><a href="#" style=" margin-top:650px;" target="_blank"><label onclick="openurl('itms-services://?action=download-manifest&url=http://192.168.1.126:8088/netcrm/ucab.plist');">
  25.         <font style="font-size: 40pt">iOS 4.0以上在线安装</font></label></a><font style="font-size: 40pt"> </font> </div>
  26. </div>
  27. </body>
  28. </html>
复制代码

核心代码:

  1. "openurl('itms-services://?action=download-manifest&url=http://192.168.1.126:8088/netcrm/ucab.plist');"
复制代码 http://192.168.1.126:8088/netcrm/ucab.plist为打包生成的ucab.plist文件的Web访问路径。 二、应用程序打包 V1.0打包: 1、编译后打包 <ignore_js_op style="Word-wrap: break-word;">

 

2、点击distribute <ignore_js_op style="word-wrap: break-word;"> 3、选择Save for Enterprise or Ad-Hoc Deployment,点击下一步 <ignore_js_op style="word-wrap: break-word;"> 4、选择打包用的企业级证书,点击下一步  <ignore_js_op style="word-wrap: break-word;"> 5、打包应用命名,保存路径选择。选中Save for Enterprise Distribution。 填写Application URL值,Application URL值为打包好的应用ipa文件的web访问路径。 填写Title值,Title值为应用名称。 注意每次打升级包时,保存的ipa文件名称要与Application URL值中web访问路径指向的ipa文件名称一致。否则的话,升级的时候会找不到升级包。  <ignore_js_op style="word-wrap: break-word;">  填写完毕,点击Save保存。V1.0打包完毕。生成ucab.ipa,ucab.plist两个文件。 目前我们已有如下文件: (1)、ucab.ipa (2)、ucab.plist (3)、ucab.html 将三个文件放到服务器端Web应用程序的同一目录下(本文中放到了服务器端应用netcrm的根目录web下),如果需要放到不同的目录,修改相应的文件访问路径即可。 至此在手机端浏览器中输入ucab.html的访问路径,本文为:http://192.168.1.126:8088/netcrm/ucab.html,即可访问安装该应用程序。效果图如下: <ignore_js_op style="word-wrap: break-word;"> 
<ignore_js_op style="word-wrap: break-word;"> 
<ignore_js_op style="word-wrap: break-word;">  V1.1 打包步骤与V1.0打包步骤一致,命名时为与1.0区别可做以下改动: <ignore_js_op style="word-wrap: break-word;">

 

打包好V1.1,V1.0两个版本后即可测试升级功能。

 

iphone手机端获取本地应用程序版本代码如下:
  1. NSString *nsstrLocalVersion = [[NSBundle mainBundle]objectForInfoDictionaryKey:@"CFBundleVersion"];
复制代码

将本地版本号与接口获取的服务器端保存的版本号进行比较,如需要升级则执行iphone手机端升级代码。
iphone手机端升级代码如下:

  1. [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@<a href="http://192.168.1.126:8088/ucab.html">http://192.168.1.126:8088/ucab.html</a>]];
复制代码

执行该代码,通过手机端浏览器打开http://192.168.1.126:8088/ucab.html地址,进行应用程序安装,即可用新版本的应用程序替换旧版本的应用程序,完成应用程序升级功能。效果图与在手机端浏览器中输入ucab.html的访问路径,安装应用程序的效果图一致