通过网络分发mobileconfig文件

3

我正在使用PHP脚本动态生成iOS设备的.mobileconfig文件,并通过Web进行服务。我使用application/x-apple-aspen-config内容类型和Content-Disposition为attachment;filename=myprofile.mobileconfig来传递文件。

我的问题是,我不断收到一个错误提示: Safari由于未知错误无法安装配置文件。我做错了什么?请查看以下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>";

我在模拟器、iPhone 3G和iPhone 4设备上都遇到了这个问题。


嘿@manuel,你能帮我一下你写的用于生成这个mobileconfig的PHP脚本吗?我是一个iPhone开发者,但对脚本语言一无所知,现在在编写程序时遇到了困难:https://dev59.com/G2Qn5IYBdhLWcg3w1aBf - Nikita P
1个回答

1
问题在于,虽然代理和代理端口是可选的,但如果像我的xml一样包含了代理端口并且为null,则配置文件将无法安装并会抛出那个令人烦恼的错误。解决方案是如果不必要就将其删除。

嗨,Manuel,你能告诉我如何重定向回我们的网站吗?因为我需要获取设备信息。 - CodePlateau

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接