从.mobileconfig获取设备UDID [英] Getting a device UDID from .mobileconfig
问题描述
我尝试编写类似于 http://whatismyudid.com/ 的函数,然后批准,将返回用户UDID和将其存储到数据库中,以供将来参考。
I'm trying to write function similar to http://whatismyudid.com/ that, then approved, will return the users UDID and store it to a database for future reference with that user.
我写了一个.mobileconfig xml文件,在Profile Installer中打开,但是当我告诉它安装该配置文件以 [alert]无效的配置文件
响应,但没有警报正文。没有说明,没有代码,没有帮助。
I have written a .mobileconfig xml doc that opens in the Profile Installer just fine but when I tell it to install the profile it responds with [alert] Invalid Profile
but no alert body. No description, no code, no help.
我是新的移动配置游戏,所以任何帮助会刺激我。
I'm new to the mobile configuration game so any help would thrill me.
这是我的配置文件:
<?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>
通过导航到http://apps.mortlabs.com/device/enroll.php 与移动safari
The profile is initialized by navigating to http://apps.mortlabs.com/device/enroll.php with mobile safari
推荐答案
我发现通过使用上面的Apache正在通过Ipad / Iphone谈话 - Kyle2011的帖子 https://discussions.apple.com/thread/3089948?start=0&tstart=0 填写解决方案的其余部分。
I found that by using the above that Apache was being talked to by the Ipad/Iphone - The post by Kyle2011 at https://discussions.apple.com/thread/3089948?start=0&tstart=0 filled in the rest of the solution.
基本上在retrieve.php页面的底部,您需要使用类似于以下内容的行将浏览器重定向到目录: -
Basically at the bottom of the retrieve.php page you need to redirect the browser to a directory by using a line similar to the following:-
header("Location: https://www.example.com/enrolment?params={$params}");
注册是一个目录 - 然后调用DirectoryIndex(通常为index.php),然后可以显示
Where enrolment is a directory - this then calls the DirectoryIndex (typically index.php) which can then display stuff to your user.
要填充$ params变量,您需要在retrieve.php脚本的顶部放置以下行:
To populate the $params variable you need the following line at the top of your retrieve.php script
$data = file_get_contents('php://input');
然后,您可以解析$ data字符串以获取所需的内容(请尝试 file_put_contents(data.txt,$ data);
或Kyle2011的示例)
You can then parse the $data string to get what you need (try file_put_contents("data.txt", $data);
or Kyle2011's example)
我还通过使用 udidgen
在Mac上的终端,而不只是使用whatismyudid.com的。
I also changed the Payload UDID to something different by using udidgen
in a terminal on a Mac rather than just using whatismyudid.com's.
更新:文件(.plist IIRC)需要通过https://提供 - 如果所有内容都通过http://提供,则它们将无法安装 - 可能最好通过https://提供包括.ipa在内的所有内容,以确保未来的更改在苹果方面不会造成问题。
Update: From iOS 7.1 some of the files (the .plist IIRC) need to be served over https:// - they will fail to install if everything is served over http:// - probably best to serve everything including the .ipa over https:// to ensure future changes on Apple's side don't cause a problem.
这篇关于从.mobileconfig获取设备UDID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!