簡體   English   中英

通過 web 分發 mobileconfig 文件

[英]Distributing a mobileconfig file over the web

我正在為 iOS 設備動態生成(在 PHP 腳本中)a.mobileconfig 文件,然后通過 web 提供它。 我正在使用application/x-apple-aspen-config內容類型和 Content disposition 作為附件交付文件;filename=myprofile.mobileconfig

我的問題是我不斷收到一條錯誤消息: Safari could not install a profile due to an unknown error 我究竟做錯了什么? 請參閱下面的 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 設備中都遇到了這個問題。

問題是,雖然 proxy 和 proxyPort 是可選的,但如果 proxyPort 包含在內並且是 null,就像在我的 xml 中一樣,那么配置文件將不會安裝並且會拋出那個煩人的錯誤。 解決方案是在不需要時將其刪除。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM