IOS7 : UDID Interim Replacement

To keep the long story short, Apple has officially declared that all UDID retrieval API and methods are no longer supported in IOS 6+. Most of the alternative method used to retrieve them like using MAC address and open UDID seems to be failing.

aotic

However, later Apple introduced another two sets of unique ID which is advertisingIdentifier and the vendorIdentifier. During my findings and trying out errors, I find that advertisingIdentifier is more suitable to be UDID interim replacement (however with some cons).

This article focus more on how to tweak your phonegap 3.4 xCode’s device plugin to retrieve advertisingIdentifier (This is because phonegap UUID wasnt good enough for the enterprise App; I was developing). You may also use this as reference on your daily XCode pure native development as you see fit.

Implementation

To implement this solution, I have modified a header file (*.h) and and the (*.m) to show you how it’s done and the experiment I’ve conducted on the device to proof the solution.

    • Add AdSupport.Framework into your xCode Framework Folder.

xcodeFramework

    • Add AdSupport’s header file into your header (file.h). For phonegap 3.4 users, find CDVDevice.h under plugins folder.

CDVDeviceH

    • Add a retriever method (file.m). In phonegap case, the CDVDevice.m file. See the highlighted text. For phonegap developers, after you add the advertisingIdentifier method; make sure you modify also the line that says [devProps setObject … forKey:@”uuid”] to include the return value of the method [self advertisingIdentifier]. Doing so will modify the return values of UUID to retrieve advertising ID instead of the default non-persistent UUID they have which, get reset after user uninstall the app.

AdId

Testing

I have modified the original phonegap method file to return the UUID (original values) to attribute called uuidold. And conducted a test.

desktop01

Before uninstalling app.

desktop02

After uninstall, and reinstall app.

The Cons of Such Method

Like I said previously, although this method returns persistent value. That doesn’t meant is bullet proof. As the user can still reset the ID via settings.

If user toggles any of this, the app will have the id reset.

If user toggles any of this, the app will have the id reset.

In my case, this is good enough (as the app I was developing is purely in-house and not for the market) for an Interim solution until Apple or third party release something more reliable.

 

Comments

comments