1
if ([[UIDevice currentDevice] respondsToSelector:@selector(identifierForVendor)]) {
        return [[[UIDevice currentDevice] identifierForVendor] UUIDString];
    }

Will this ever change? I originally wanted to use MAC address, but apparently 7+ doesn't return it. I've called this from a dev app i'm working on, and read that it is calculated using the bundle id.

Post app store release, will this be consistent forever?

button
  • 666
  • 6
  • 14
Simon.
  • 1,886
  • 5
  • 29
  • 62
  • Unless application gets delete and re installation occurs, Vendor Id remains same.. – itsji10dra Mar 24 '15 at 12:40
  • 1
    I create my own CFUUIDCreate and store it in the keychain with the hope that user has iCloud sync enabled, this allows my apps on any of the users devices to get the id. – BooRanger Mar 24 '15 at 12:41
  • 1
    You should approve the answer from mttrb. That's the correct one! The UUID will change if the user resets or reinstalls the app. – Razvan Mar 24 '15 at 12:42

2 Answers2

6

From the UIDevice class reference:

The value in this property remains the same while the app (or another app from the same vendor) is installed on the iOS device. The value changes when the user deletes all of that vendor’s apps from the device and subsequently reinstalls one or more of them. The value can also change when installing test builds using Xcode or when installing an app on a device using ad-hoc distribution. Therefore, if your app stores the value of this property anywhere, you should gracefully handle situations where the identifier changes.

mttrb
  • 8,297
  • 3
  • 35
  • 57
1

I don't think you can get hold of the UDID from the device. It requires some profile installation, or the user to use the iTunes system.

So, the UDID is constant, but that's not what you're asking for there. I'm not sure there's a way to find it. I believe this to be for security reasons.

The value of this property is the same for apps that come from the same vendor running on the same device.

button
  • 666
  • 6
  • 14
  • Read the OP carefully: it's about the identifierForVendor UUID, not the device's UDID. – Razvan Mar 24 '15 at 13:04
  • 1
    @Razvan Read the OP carefully: the title says: "Will iOS's UDID always be the same?". (And the tag for the OP, as I just noticed.) UDID. – button Mar 24 '15 at 13:08
  • @button is right, i automatically assumed stack folk would understand in context to iOS. assumptions aren't good – Simon. Mar 24 '15 at 18:54
  • @Simon All good. Perhaps update the copy and tags on the issue so others can find it and not get confused (since there are multiple mentions of UDID)? If I am able to I can maybe remove this answer as it's not really relevant. – button Mar 25 '15 at 08:51