通过网络分发 mobileconfig 文件

发布于 2024-11-18 11:40:24 字数 3664 浏览 2 评论 0原文

我正在为 iOS 设备动态生成(在 PHP 脚本中)一个 .mobileconfig 文件,然后通过网络提供该文件。我正在交付具有 application/x-apple-aspen-config 内容类型和内容处置为 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 设备中都遇到了这个问题。

I am dynamically generating (in a PHP script) a .mobileconfig file for iOS devices and then serve it over the web. I am delivering the file with the application/x-apple-aspen-config content type and with Content disposition as attachment;filename=myprofile.mobileconfig.

My problem is I keep getting an error that says: Safari could not install a profile due to an unknown error. What am I doing wrong? See the mobileconfig file below:

    $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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

旧竹 2024-11-25 11:40:24

问题是,虽然 proxy 和 proxyPort 是可选的,但如果包含 proxyPort 并且为空(如我的 xml 中所示),则配置文件将不会安装,并且会抛出那个烦人的错误。解决方案是如果不需要的话将其删除。

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. The solution is to remove it if it's not necessary.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文