从.mobileconfig获取设备UDID

jos*_*eym 21 configuration utility udid ios

我正在尝试编写类似于http://whatismyudid.com/的函数,然后批准,将返回用户UDID并将其存储到数据库以供将来与该用户一起参考.

我已经编写了一个在Profile Installer中打开的.mobileconfig xml文档,但是当我告诉它安装配置文件时,它会响应[alert] Invalid Profile但没有警报正文.没有描述,没有代码,没有帮助.

我是移动配置游戏的新手,所以任何帮助都会激动我.

这是我的配置文件:

<?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>
    <dict>
        <key>URL</key>
        <string>http://apps.mortlabs.com/device/retrieve.php</string>
        <key>DeviceAttributes</key>
        <array>
            <string>UDID</string>
            <string>IMEI</string>
            <string>ICCID</string>
            <string>VERSION</string>
            <string>PRODUCT</string>
        </array>
    </dict>
    <key>PayloadOrganization</key>
    <string>MortLabs.com</string>
    <key>PayloadDisplayName</key>
    <string>Profile Service</string>
    <key>PayloadVersion</key>
    <integer>1</integer>
    <key>PayloadUUID</key>
    <string>B958E359-34C2-42F4-BD0C-C985E6D5376B</string>
    <key>PayloadIdentifier</key>
    <string>com.mortlabs.profile-service</string>
    <key>PayloadDescription</key>
    <string>This temporary profile will be used to find and display your current device's UDID.</string>
    <key>PayloadType</key>
    <string>Profile Service</string>
</dict>
</plist>
Run Code Online (Sandbox Code Playgroud)

通过移动safari 导航到http://apps.mortlabs.com/device/enroll.php来初始化配置文件

Kev*_*Kev 13

我发现通过使用上面的说法,Ipad/Iphone正在与Apache交谈--Kyle2011的帖子在https://discussions.apple.com/thread/3089948?start=0&tstart=0填写了其余的解决方案.

基本上在retrieve.php页面的底部,您需要使用类似于以下内容的行将浏览器重定向到目录: -

header("Location: https://www.example.com/enrolment?params={$params}");
Run Code Online (Sandbox Code Playgroud)

注册是一个目录 - 然后调用DirectoryIndex(通常是index.php),然后可以向用户显示内容.

要填充$ params变量,需要在retrieve.php脚本顶部添加以下行

$data = file_get_contents('php://input');
Run Code Online (Sandbox Code Playgroud)

然后,您可以解析$ data字符串以获得所需内容(尝试file_put_contents("data.txt", $data);或Kyle2011的示例)

我还通过udidgen在Mac上的终端中使用而不是仅仅使用whatismyudid.com 将Payload UDID更改为不同的东西.

更新:从iOS 7.1中,某些文件(.plist IIRC)需要通过https://提供 - 如果所有内容都通过http://提供,它们将无法安装 - 可能最适合提供包括.ipa在内的所有内容https://以确保Apple方未来的更改不会导致问题.


Pix*_*man 6

关于最后一页(文件夹)的注意事项.

如果要使用页面脚本进行最终重定向来代替文件夹.

你可以改变这个:

标题("位置:https: //www.example.com/enrolment? params = {$ params}");

通过

标题("位置:https: //www.example.com/enrolment.php? params = {$ params}",true,301);

来源:php.net手册上的标题函数

这是工作 !

  • 对于其他人,如果您没有301重定向,则会收到无效的个人资料. (3认同)