简体   繁体   English

通过 web 分发 mobileconfig 文件

[英]Distributing a mobileconfig file over the web

I am dynamically generating (in a PHP script) a.mobileconfig file for iOS devices and then serve it over the web.我正在为 iOS 设备动态生成(在 PHP 脚本中)a.mobileconfig 文件,然后通过 web 提供它。 I am delivering the file with the application/x-apple-aspen-config content type and with Content disposition as attachment;filename=myprofile.mobileconfig .我正在使用application/x-apple-aspen-config内容类型和 Content disposition 作为附件交付文件;filename=myprofile.mobileconfig

My problem is I keep getting an error that says: Safari could not install a profile due to an unknown error .我的问题是我不断收到一条错误消息: Safari could not install a profile due to an unknown error What am I doing wrong?我究竟做错了什么? See the mobileconfig file below:请参阅下面的 mobileconfig 文件:

    $content =  "<?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>PayloadContent</key>
    <array>
        <dict>
            <key>PayloadContent</key>
            <array>
                <dict>
                    <key>DefaultsData</key>
                    <dict>
                        <key>apns</key>
                        <array>
                            <dict>
                                <key>apn</key>
                                <string>$apnName</string>
                                <key>password</key>
                                <string>$password</string>
                                <key>proxy</key>
                                <string></string>
                                <key>proxyPort</key>
                                <integer></integer>
                                <key>username</key>
                                <string>$userName</string>
                            </dict>
                        </array>
                    </dict>
                    <key>DefaultsDomainName</key>
                    <string>com.apple.managedCarrier</string>
                </dict>
            </array>
            <key>PayloadDescription</key>
            <string><removed before posting here></string>
            <key>PayloadDisplayName</key>
            <string><removed before posting here></string>
            <key>PayloadIdentifier</key>
            <string><removed before posting here></string>
            <key>PayloadOrganization</key>
            <string><removed before posting here></string>
            <key>PayloadType</key>
            <string>com.apple.apn.managed</string>
            <key>PayloadUUID</key>
            <string>8B9A29CC-7C6E-4E32-B4AD-18ED3FDDB64D</string>
            <key>PayloadVersion</key>
            <integer>1</integer>
        </dict>
    </array>
    <key>PayloadDescription</key>
    <string><removed before posting here></string>
    <key>PayloadDisplayName</key>
    <string><removed before posting here></string>
    <key>PayloadIdentifier</key>
    <string><removed before posting here></string>
    <key>PayloadOrganization</key>
    <string><removed before posting here></string>
    <key>PayloadRemovalDisallowed</key>
    <false/>
    <key>PayloadType</key>
    <string>Configuration</string>
    <key>PayloadUUID</key>
    <string>975760AB-9CCE-4496-9D2F-04FD605DDBB9</string>
    <key>PayloadVersion</key>
    <integer>1</integer>
</dict>
</plist>";

I am getting this issue both in the simulator and iPhone 3G and iPhone 4 devices.我在模拟器和 iPhone 3G 和 iPhone 4 设备中都遇到了这个问题。

The problem is that although proxy and proxyPort are optional, if proxyPort is included and is null, as in my xml then the profile won't install and will throw that annoying error.问题是,虽然 proxy 和 proxyPort 是可选的,但如果 proxyPort 包含在内并且是 null,就像在我的 xml 中一样,那么配置文件将不会安装并且会抛出那个烦人的错误。 The solution is to remove it if it's not necessary.解决方案是在不需要时将其删除。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM