Mac OS 10.10企业发布ipa部署方式

来源:互联网 发布:mac excel单元格内换行 编辑:程序博客网 时间:2024/06/05 04:25

操作系统环境:Mac OS 10.10


一、部署https服务器

iOS 7.1之后plist的文件需要部署在https服务器,才能通过认证安装。这个有很多方式来实现,比如将plist文件放置在第三方网站上(如:https://git.oschina.net/),但是放在第三方网站在自动化处理有很多不便,下面先介绍如何拥有自己的https服务器。


1.生成CA证书和自签名证书

openssl genrsa -out CA.key2048 

openssl req -x509 -new -key CA.key -out CA.cer -days730 -subj /CN="Custom CA"

openssl genrsa -out server.key2048

openssl req -new -out server.req -key server.key -subj /CN=www.ipa.com

openssl x509 -req -inserver.req -out server.cer -CAkey CA.key -CA CA.cer -days 365 -CAcreateserial -CAserial serial


CA.cer 就是CA证书,https证书的颁发者,需要手动导入到系统中,iOS可以通过系统邮箱导入到描叙文件中。

server.cer server.key 是https的工作证书,复制到/private/etc/apache2/ 目录中。

www.ipa.com 是与https证书绑定的域名,访问https服务器需要通过域名来访问。


2.配置apache

 /private/etc/apache2/httpd.conf  , 编辑这个文件去掉下面二行前面的 '#'

LoadModule ssl_module libexec/apache2/mod_ssl.so
Include /private/etc/apache2/extra/httpd-ssl.conf


/private/etc/apache2/extra/httpd-ssl.conf ,编辑这个文件,找到下面两行,确保证书路径正确


SSLCertificateFile "/private/etc/apache2/server.cer" 注意这里将crt改成cer
SSLCertificateKeyFile "/private/etc/apache2/server.key"


到这里就配置完了,检查配置,没问题的话重启Apache就好了


sudo apachectl configtest
sudo apachectl restart


二. 部署ipa和plist文件

在/Library/WebServer/Documents/ 目录下生产install目录用于存放ipa,plist 和html。


1.生成demo.plist文件,plist文件格式如下

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<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>
          <string>https://www.ipa.com/install/demo.ipa</string>
        </dict>
      </array>
      <key>metadata</key>
      <dict>
        <key>title</key>
        <string>测试Demo</string>
        <key>bundle-version</key>
        <string>1.0</string>
        <key>kind</key>
        <string>software</string>
        <key>bundle-identifier</key>
        <string>com.company.demo</string>
      </dict>
    </dict>
  </array>
</dict>
</plist>

https://www.ipa.com/install/demo.ipa是ipa的存放目录。

2.生成index.html,格式如下

<html xmlns=\"http://www.w3.org/1999/xhtml\">
<meta http-equiv="Content-Type" content="text/html; charset=utf8" />
<head>
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />
<body>
<div style='font-size:100px;'>

<a href='itms-services://?action=download-manifest&url=https://www.ipa.com/install/demo.plist'>测试Demo</a>

</div>
<body>
</html> 

https://www.ipa.com/install/demo.plist 为plist的访问路径。


三.安装ipa

1.通过邮件将CA.cer 导入iOS系统描述文件并信任安装。用自带邮箱收取邮件,点击附件即可安装。

2.在safari中访问 https://www.ipa.com/install/index.html ,点击链接即可开始安装ipa。

3.这里由于www.ipa.com是自定义的域名,不能通过DNS直接解析,因此还需要配置host,但iPhone没有越狱是无法配置的,这个时候还是得借助你的Mac机器了。

在Mac中配置host,www.ipa.com 对应的ip地址,然后利用网络代理工具(如 charles),通过代理方式让iPhone来正确访问www.ipa.com。代理设置在wifi连接好的叹号处进入。

4.还可以将https://www.ipa.com/install/index.html 做成二维码,变成高大上的安装方式了。

0 0
原创粉丝点击