今天调试自己开发的一款企业级App,发现通过之前的url无法升级安装企业应用,一直提示“无法安装应用程序 因为http://xxx.xxx.xxx证书无效”,折腾了一番,终于在StackOverFlow上找到了答案。在这里分享给大家。
StackOverFlow接:http://stackoverflow.com/questions/20276907/enterprise-app-deployment-doesnt-work-on-ios-7-1/22325916#22325916
原因是由于要安装更新企业应用,url必须是https的,不能是http,这就要求我们的服务器要支持https。因此,只要将原链接:
itms-services://?action=download-manifest&url=http://example.com/manifest.plist
改为
itms-services://?action=download-manifest&url=https://example.com/manifest.plist
测试
另外,如果想要在自己电脑上测试,可以运行下面脚本来支持https!
GitHub下载链接:https://gist.github.com/dergachev/7028596
# taken from http://www.piware.de/2011/01/creating-an-https-server-in-python/
# generate server.xml with the following command:
# openssl req -new -x509 -keyout server.pem -out server.pem -days 365 -nodes
# run as follows:
# python simple-https-server.py
# then in your browser, visit:
# https://localhost:4443
import BaseHTTPServer, SimpleHTTPServer
import ssl
httpd = BaseHTTPServer.HTTPServer(('localhost', 4443), SimpleHTTPServer.SimpleHTTPRequestHandler)
httpd.socket = ssl.wrap_socket (httpd.socket, certfile='./server.pem', server_side=True)
httpd.serve_forever()
其中httpd = BaseHTTPServer.HTTPServer((‘localhost’, 4443),
把’localhost’改成’ ‘,否则不能在手机的浏览器访问。
httpd = BaseHTTPServer.HTTPServer((’ ‘, 4443);
在电脑上启动:
python -m SimpleHTTPServer访问
https://192.168.xx.xx:4443
itms-services://?action=download-manifest&url=http://192.168.xx.xx:4443/manifest.plist
可以把plist上传到自己本机,然后可以用手机测试企业级app更新升级了。