Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Looks like you can get the UDID without terribly too much work, this answer is from this blog post: <a href="http://bendytree.com/tips/Getting-an-iPhone-UDID-from-Mobile-Safari" rel="noreferrer">http://bendytree.com/tips/Getting-an-iPhone-UDID-from-Mobile-Safari</a></p> <p>Apple allows developers to get a person's UDID (&amp; do many other things) through a special interaction between the phone and your web server. Here's an overview:</p> <ol> <li>They click a link to a .mobileconfig XML file on your website </li> <li>This pulls up their provisioning settings on their phone &amp; offers them an 'Install' button (which they must press) </li> <li>The phone sends the data you requested in encrypted XML to the URL you set in your .mobileconfig </li> <li>You process the resulting data &amp; show them a "thank you" web page</li> </ol> <p>Example .mobileconfig for retrieving a UDID:</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"&gt; &lt;plist version="1.0"&gt; &lt;dict&gt; &lt;key&gt;PayloadContent&lt;/key&gt; &lt;dict&gt; &lt;key&gt;URL&lt;/key&gt; &lt;string&gt;http://yourwebsite.com/retrieve.php&lt;/string&gt; &lt;key&gt;DeviceAttributes&lt;/key&gt; &lt;array&gt; &lt;string&gt;UDID&lt;/string&gt; &lt;string&gt;IMEI&lt;/string&gt; &lt;string&gt;ICCID&lt;/string&gt; &lt;string&gt;VERSION&lt;/string&gt; &lt;string&gt;PRODUCT&lt;/string&gt; &lt;/array&gt; &lt;/dict&gt; &lt;key&gt;PayloadOrganization&lt;/key&gt; &lt;string&gt;yourwebsite.com&lt;/string&gt; &lt;key&gt;PayloadDisplayName&lt;/key&gt; &lt;string&gt;Profile Service&lt;/string&gt; &lt;key&gt;PayloadVersion&lt;/key&gt; &lt;integer&gt;1&lt;/integer&gt; &lt;key&gt;PayloadUUID&lt;/key&gt; &lt;string&gt;9CF421B3-9853-4454-BC8A-982CBD3C907C&lt;/string&gt; &lt;key&gt;PayloadIdentifier&lt;/key&gt; &lt;string&gt;com.yourwebsite.profile-service&lt;/string&gt; &lt;key&gt;PayloadDescription&lt;/key&gt; &lt;string&gt;This temporary profile will be used to find and display your current device's UDID.&lt;/string&gt; &lt;key&gt;PayloadType&lt;/key&gt; &lt;string&gt;Profile Service&lt;/string&gt; &lt;/dict&gt; &lt;/plist&gt; </code></pre> <p>You'll need to fill in your own URL and PayloadUUID. The PayloadUUID doesn't have to be generated in a special way - just make sure it is unique to your app.</p> <p>Also make sure to register a file handler for .mobileconfig (content type application/x-apple-aspen-config).</p> <p>PayloadOrganization and PayloadDescription are shown to the user when they see the profile. In my description, I said something like "Press Install to continue..." since they may be confused on this screen.</p> <p>You don't have to sign your .mobileconfig, but if you don't then they will see a warning that it is not signed (see below).</p> <p><img src="https://i.stack.imgur.com/pVMgq.jpg" alt="Not signed profile image"></p> <p><strong>Receiving the Requested Data</strong> QUIRK WARNING: For whatever reason, the process is EXTREMELY particulary about how your server responds when it sends the user to your preset URL. After many tries, I believe that your receiving url MUST be a .php file. This sounds nuts but I'm serious.</p> <p>PHP was about the last language I wanted to work in, so I chose to redirect to a page that could handle it better.</p> <pre><code>&lt;?php $data = file_get_contents('php://input'); header("Location: http://www.mysite.com/Results?data=".rawurlencode($data)); ?&gt; </code></pre> <p>QUIRK WARNING:: The only way I (&amp; others) have got it working is to redirect to a directory. I've tried to redirect to a .aspx page and it failed. If you do not get this right, then a vague error message will be shown to the user &amp; they will be stuck. If you have a better explaination for this, please leave a comment below.</p> <p>The page that you redirect to is the page that is shown to the user to end the process.</p> <p>In my example, that page would receive a 'data' query string parameter containing the xml response from the phone.</p> <pre><code>&lt;!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"&gt; &lt;plist version="1.0"&gt; &lt;dict&gt; &lt;key&gt;IMEI&lt;/key&gt; &lt;string&gt;12 123456 123456 7&lt;/string&gt; &lt;key&gt;PRODUCT&lt;/key&gt; &lt;string&gt;iPhone4,1&lt;/string&gt; &lt;key&gt;UDID&lt;/key&gt; &lt;string&gt;b59769e6c28b73b1195009d4b21cXXXXXXXXXXXX&lt;/string&gt; &lt;key&gt;VERSION&lt;/key&gt; &lt;string&gt;9B206&lt;/string&gt; &lt;/dict&gt; &lt;/plist&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload