iphone - 通过网络分发 mobileconfig 文件

标签 iphone ios ios4 mobile-safari

我正在(在 PHP 脚本中)为 iOS 设备动态生成一个 .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 设备中都遇到了这个问题。

最佳答案

问题是,虽然代理和代理端口是可选的,但如果包含代理端口并且为空,就像在我的 xml 中一样,那么配置文件将不会安装,并且会抛出令人讨厌的错误。解决方案是在不需要时将其删除。

关于iphone - 通过网络分发 mobileconfig 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6569256/

相关文章:

ios - 替换 ftp 服务器上的文件

iphone - SQLite 的删除和写入,使用 JSON 数据同步 MySQL 中的远程表

video - 在iOS 4上如何在后台播放YouTube视频的音频?

iphone - 如何在 ios 中生成 SHA256 和 CRC32

iphone - 使用 NSPredicate 将以数字或符号开头的字符串过滤到 NSArray

私有(private) CA 的 iOS 11 模拟器问题

iphone - 成就完成处理程序不检测何时没有可用的 Internet 连接

objective-c - libxml2 错误。无此文件或目录

iphone - 尽快在2台iOS设备之间发送数据

iphone - 检测 UITableView 背景上的点击