使用Apple Configurator创建系统配置文件管理iOS设备软件 并附使用plist安装ipa应用

将H5网页制作成图标放到手机桌面上

.mobileconfig 文件是 iOS 的配置文件格式(xml格式),用于推送和安装特定的配置,包括网页的快捷方式。下面是一个简单的配置文件模板,它将创建一个桌面图标并指向特定的 H5 网页
举个粟子,也可以直接使用在线生成配置文件工具生成一个

<?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>ConsentText</key>
    <dict>
        <key>default</key>
        <string>这是为https://www.lvtao.net提供的服务</string>
    </dict>
    <key>PayloadContent</key>
    <array>
        <dict>
            <key>FullScreen</key>
            <true/>
            <key>IgnoreManifestScope</key>
            <false/>
            <key>IsRemovable</key>
            <true/>
            <key>Label</key>
            <string>全栈开发</string>
            <key>PayloadDescription</key>
            <string>配置 Web Clip 设置</string>
            <key>PayloadDisplayName</key>
            <string>Web Clip</string>
            <key>PayloadIdentifier</key>
            <string>com.apple.webClip.managed.84DEC52A-1361-40B5-8A0F-A47AF5BC5CA5</string>
            <key>PayloadType</key>
            <string>com.apple.webClip.managed</string>
            <key>PayloadUUID</key>
            <string>84DEC52A-1361-40B5-8A0F-A47AF5BC5CA5</string>
            <key>PayloadVersion</key>
            <integer>1</integer>
            <key>Precomposed</key>
            <false/>
            <key>URL</key>
            <string>https://www.lvtao.net</string>
        </dict>
    </array>
    <key>PayloadDescription</key>
    <string>我是全栈开发网站的证书</string>
    <key>PayloadDisplayName</key>
    <string>全栈开发</string>
    <key>PayloadIdentifier</key>
    <string>LTMBP.51CDD2DB-2C67-4207-B9CB-E758C1A9E481</string>
    <key>PayloadRemovalDisallowed</key>
    <false/>
    <key>PayloadType</key>
    <string>Configuration</string>
    <key>PayloadUUID</key>
    <string>19406F61-33D1-4753-B8E7-83B33365BE5D</string>
    <key>PayloadVersion</key>
    <integer>1</integer>
</dict>
</plist>

当你有类似这样的一个配置文件后,就可以签名,然后将签名好的.mobileconfig文件上传到服务器。
用户通过 Safari 浏览器访问文件下载链接即可触发安装,安装后,H5 网页图标将出现在 iPhone 的桌面上

使用Apple Configurator来创建配置文件

  1. 先下载配置工具,苹果官方的,大胆用,在应用商店搜索Apple Configurator
    0.png
  2. 打开后,菜单-文件-新建描述文件
    1.png
  3. 窗口中选择通用
    2.png
  4. 填上自己的应用信息
    2-1.png
  5. 找到Web.Clip-配置
    3.png
  6. 填写域名等信息
    4.png
    好了,保存...

这样你就制作了一个未签名的配置文件啦

使用域名证书来签名配置文件

准备域名相关的证书文件(可以用免费域名证书,当然有苹果的企业证书更好...)

  1. 签名需要3个⽂件

    • cert.crt 服务器端⽤于签名的证书
    • cert.key 服务器端⽤于签名的证书的秘钥
    • ca.crt 其他机构为服务器颁发的CA证书
  2. 利⽤openssl给配置文件签名

    openssl smime -sign -in unsigned.mobileconfig -out signed.mobileconfig -signer cert.crt -inkey cert.key -certfile ca.crt -outform der -nodetach

    对应的参数注解如下

    openssl smime -sign \
    -in config.mobileconfig \  # 输入的 mobileconfig 文件
    -out signed.mobileconfig \  # 输出的已签名文件
    -signer cert.pem \  # 证书文件
    -inkey cert.key \  # 私钥文件
    -certfile ca.crt \  # 证书链
    -outform der \ # 输出二进制格式
    -nodetach # 参数用于确保签名和数据被打包在一起,生成一个嵌入式签名的文件

    签名成功之后将signed.mobileconfig⽂件制作成⼀个下载连接,⽤safari浏览器打开并允许,安装这个描述⽂件就可以了,再看桌⾯就会有⼀个图标
    而我们的证书也会是绿色啦...
    5.png

使用plist创建ipa应用的安装脚本

同样的plist文件也是一个xml,当然我也做了一个在线生成IPA文件安装脚本工具

<?xml version="1.0" encoding="UTF-8"?>
<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><![CDATA[https://file.lvtao.net/ipa/blog.ipa]]></string>
                </dict>
                <dict>
                    <key>kind</key>
                    <string>display-image</string>
                    <key>needs-shine</key>
                    <integer>0</integer>
                    <key>url</key>
                    <string><![CDATA[https://www.lvtao.net/wp-content/uploads/logo.svg]]></string>
                </dict>
                <dict>
                    <key>kind</key>
                    <string>full-size-image</string>
                    <key>needs-shine</key>
                    <true/>
                    <key>url</key>
                    <string><![CDATA[https://www.lvtao.net/wp-content/uploads/logo.svg]]></string>
                </dict>
            </array>
            <key>metadata</key>
            <dict>
                <key>bundle-identifier</key>
                <string>net.lvtao.app.appname</string>
                <key>bundle-version</key>
                <string><![CDATA[1.0]]></string>
                <key>kind</key>
                <string>software</string>
                <key>title</key>
                <string><![CDATA[全栈博客]]></string>
            </dict>
        </dict>
    </array>
</dict>
</plist>

修改对应的配置后,主要几点是ipa文件地址https://file.lvtao.net/ipa/blog.ipa,软件包的名字net.lvtao.app.appname,图标LOGO地址https://www.lvtao.net/wp-content/uploads/logo.svg

然后你就可以制作一个下载页面,链接地址用itms-services://?action=download-manifest&url=app.plist,当然连接中的app.plist可以使用带网址的url链接

标签: macOS

相关文章

macOS下使用UTM安装Alpine Linux虚拟机

在macOS下使用UTM(Universal Turing Machine)安装Alpine Linux虚拟机是一个相对简单的过程,但需要一些基本的配置和步骤。以下是详细的指南,涵盖了从安装UT...

图片Base64编码

CSR生成

图片无损放大

图片占位符

Excel拆分文件