我动态生成(在PHP脚本中)iOS设备的.mobileconfig文件,然后通过Web提供。我使用 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设备上都遇到了这个问题。
答案 0 :(得分:1)
问题是虽然proxy和proxyPort是可选的,但是如果包含proxyPort并且为null,就像在我的xml中一样,那么配置文件将不会安装并且会抛出那个烦人的错误。解决方案是在没有必要的情况下将其删除。