Appcelerator Developer Blog

The new way we UDID

A major change that came along with iOS5 was Apple’s deprecation of a platform-generated unique device identifier (UDID). In previous Titanium releases, this property was accessed via “Ti.Platform.id”, and was frequently used to track per-user data in mobile applications.

While this property can still be accessed in iOS 5, it is not certain how long it will remain available. To avoid confusion, and ensure that new apps do not use a deprecated API, we replaced the Apple UDID with our own. This means that “Ti.Platform.id” now returns a Titanium-created ID that uses, in part, the device MAC address.

While we recommend that all developers move away from using the old UUID property as soon as possible, we created a module to expose this deprecated property, to help provide a grace period in which you can transition to the new one.

To use this module:

  1. Download the module
  2. Copy this zip file into the folder of your Titanium SDK
  3. Add <module version=”1.0″ platform=”iphone”>ti.udid</module> to your TiApp.xml where you currently have </modules>
  4. Use the oldUDID property to access the old UDID… once Apple stops supplying this, it will simply return a blank string. (for an example of how to call this property see this file)

Then to update your UDID, simply do something along these lines:

To be clear, this module should NOT be considered a permanent workaround to Apple’s UDID changes. We provide it purely to help you to migrate to the new Titanium-created UDID.

14 Responses to “The new way we UDID”

  1. florian says:

    we’ve thougt about macid as solution too but we decided NOT to use it because the wifi and the 3g module respond diffferent ids. how do you handle this?

    just to clarify: the new ti id is unique and consitent in every request?

    disclaimer: i did not look in the sourcefiles so far but on a bus you have nothing to do except writing comments on blogposts ;)

  2. Matt Apperson says:

    Yes, the the ti id is unique and consistent in every request

  3. Matt,

    When you say “unique and consistent in every request”, does that also mean that it is persistent across app launches and app removal and reinstallation?

    In other words has the same characteristics as the Apple UDID, the TI-ID will always be the same for a given device, regardless of OS version, application version, etc.

    Thanks
    Henning

  4. Bafmin says:

    Thank you for this, I am hoping 1.8 will have this built in with a single request.

  5. Alan Leard says:

    Great post Matt. Thanks for clarifying the issue and making that module available!

  6. Johan Lundin says:

    From which version of the Titanium SDK does Ti.Platform.id no longer return the native udid?

  7. Kevin Whinnery says:

    @Johan this is a new change as of 1.7.3

  8. Manish Singh says:

    Can someone comment on Henning Glatter-Gotz’s question above. I need to know the answer as well. thanks.

  9. Kevin Whinnery says:

    @henning @manish Ti.Platform.id is not completely static – it would be subject the change due to a number of actions to update the device a user might take (os upgrade being one).

  10. Eneko says:

    Does this solve the problem with Android 2.2 devices returning the same id?

  11. byF says:

    Hi! We’re using SDK 1.8.0 from Nov 8 and the device id returned by Ti.Platform.id is not consistent across app launches. Which basicly makes our “fraud” blocking mechanism unusable.

  12. John Galt says:

    Looks very promising but I was having Android issues before.

    Real Estate IDX

  13. lucassp says:

    My tiapp.xml becomes invalid after adding the module line:

    ti.udid</module

    any hints?