Search code examples
ios9udid

How to find UDID for ios9


Since iOS 7 it's impossible to get UDID directly on an Apple iOS device.

i know apple suggests for using UIDevice.currentDevice().identifierForVendor?.UUIDString. but it changes every time after uninstalling the app.

i want to send GCM to the users, and per user, there are two to three ios devices. so for identifying the devices uniquely i want UDID.

for ex. if user has two devices

in my server database i'm storing it like this

userID->>> [email protected]

GCMID->>> {UDIDForDevice1:GCMTokenForDevice1,UDIDForDevice2:GCMTOkenForDevice2}


Solution

  • If you want to really uniquely identify a device, store a UUID on the keychain. See How to preserve identifierForVendor in ios after uninstalling ios app on device?.

    For GCM you should probably use the Instance ID API instead of inventing your own identification format.


    For the original question, the site www.easy-udid.com uses Over-the-Air Profile Delivery and Configuration to obtain the UDID and other device information.

    The "Get my UDID" button links to a qilin.en.mobileconfig file, which is a Configuration Profile plist file with the following content:

    {
      "PayloadType":"Profile Service",
      "PayloadContent":{
        "DeviceAttributes":[
          "UDID",
          "VERSION",
          "PRODUCT",
          "SERIAL"
        ],
        "URL":"http://www.easy-udid.com/retrieve.php"
      },
      ...
    }
    

    When the user installs the profile, the phone will send the UDID, version, product and serial number while opening the provided URL (http://www.easy-udid.com/retrieve.php). The server can then display the result to the user.

    See https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/iPhoneOTAConfiguration/ConfigurationProfileExamples/ConfigurationProfileExamples.html for some sample responses.