通过MDM“InstallProfile”命令

时间:2012-10-10 05:31:43

标签: iphone ios mdm

我可以查询设备信息,获取设备上安装的配置文件列表等,但无法在设备上安装配置文件。

我已配置限制配置文件。当我在我的服务器上托管并通过Safari下载它时,它会安装。但是当我将其编码为base64(根据MDM要求)并尝试安装它时,我收到以下错误。

DM: Attempting to perform MDM request: InstallProfile
Oct 10 10:25:32 iPhone-4 mdmd[516] <Notice>: (Error) MC: Failed to parse profile data. Error: NSError:
Desc   : Invalid Profile
US Desc: Invalid Profile
Domain : MCProfileErrorDomain
Code   : 1000
Type   : MCFatalError
Oct 10 10:25:32 iPhone-4 mdmd[516] <Notice>: (Error) MDM: Command Status: Error
Error: NSError:
Desc   : Invalid Profile
US Desc: Invalid Profile
Domain : MCProfileErrorDomain
Code   : 1000
Type   : MCFatalError

以下是我正在尝试安装的配置文件的Base64编码数据。我根据建议herehere

生成了以下数据
PHBsaXN0IHZlcnNpb249IjEuMCI+CjxkaWN0PgoJPGtleT5QYXlsb2FkQ29udGVudDwva2V5PgoJ
PGFycmF5PgoJCTxkaWN0PgoJCQk8a2V5PlBheWxvYWREZXNjcmlwdGlvbjwva2V5PgoJCQk8c3Ry
aW5nPjwvc3RyaW5nPgoJCQk8a2V5PlBheWxvYWREaXNwbGF5TmFtZTwva2V5PgoJCQk8c3RyaW5n
PlJlc3RyaWN0aW9uczwvc3RyaW5nPgoJCQk8a2V5PlBheWxvYWRJZGVudGlmaWVyPC9rZXk+CgkJ
CTxzdHJpbmc+Y28ubXltZG0ucmVzdHJpY3Rpb25zLnJlc3RyaWN0aW9uczE8L3N0cmluZz4KCQkJ
PGtleT5QYXlsb2FkT3JnYW5pemF0aW9uPC9rZXk+CgkJCTxzdHJpbmc+PC9zdHJpbmc+CgkJCTxr
ZXk+UGF5bG9hZFR5cGU8L2tleT4KCQkJPHN0cmluZz5jb20uYXBwbGUuYXBwbGljYXRpb25hY2Nl
c3M8L3N0cmluZz4KCQkJPGtleT5QYXlsb2FkVVVJRDwva2V5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lRnJhdWRXYXJuaW5nPC9r
ZXk+CgkJCTxmYWxzZS8+CgkJPC9kaWN0PgoJPC9hcnJheT4KCTxrZXk+UGF5bG9hZERlc2NyaXB0
aW9uPC9rZXk+Cgk8c3RyaW5nPlByb2ZpbGUgZGVzY3JpcHRpb24uPC9zdHJpbmc+Cgk8a2V5PlBh
eWxvYWREaXNwbGF5TmFtZTwva2V5PgoJPHN0cmluZz5HZW5lcmFsPC9zdHJpbmc+Cgk8a2V5PlBh
eWxvYWRJZGVudGlmaWVyPC9rZXk+Cgk8c3RyaW5nPmNvLm15bWRtLnJlc3RyaWN0aW9uczwvc3Ry
aW5nPgoJPGtleT5QYXlsb2FkT3JnYW5pemF0aW9uPC9rZXk+Cgk8c3RyaW5nPjwvc3RyaW5nPgoJ
PGtleT5QYXlsb2FkUmVtb3ZhbERpc2FsbG93ZWQ8L2tleT4KCTxmYWxzZS8+Cgk8a2V5PlBheWxv
YWRUeXBlPC9rZXk+Cgk8c3RyaW5nPkNvbmZpZ3VyYXRpb248L3N0cmluZz4KCTxrZXk+UGF5bG9h
ZFVVSUQ8L2tleT4KCTxzdHJpbmc+MUU4MjY0NEEtQjRCRi00RkM0LTgxQTgtNTdCRTFDOTg4MTg1
PC9zdHJpbmc+Cgk8a2V5PlBheWxvYWRWZXJzaW9uPC9rZXk+Cgk8aW50ZWdlcj4xPC9pbnRlZ2Vy
Pgo8L2RpY3Q+CjwvcGxpc3Q+Cg==

我已在MDM有效内容中启用了配置文件安装。请帮我解决问题。

2 个答案:

答案 0 :(得分:2)

您缺少XML声明和plist doctype。将以下两行添加到配置文件的顶部(在base64编码之前):

<?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">

答案 1 :(得分:2)

问题解决了。出于烦恼,我删除了.mobileConfig的XML标记之间的额外空格。见下文......

<强>更改

<dict>
    <key>PayloadContent</key>
    <array>
        <dict>
            <key>PayloadDescription</key>
            <string></string>
            <key>PayloadDisplayName</key>
            <string>Restrictions</string>
..........
</dict>

<dict><key>PayloadContent</key><array><dict><key>PayloadDescription</key><string></string><key>PayloadDisplayName</key><string>Restrictions</string>..........</dict>

我使用this网站将其编码为base64。 (仅用于测试)

对于将来的观看者,您需要从<dict>代码

开始