16

Possible Duplicate:
UIDevice uniqueIdentifier Deprecated - What To Do Now?

Even if Apple was not at Barcelone's MWC (mobile world congress), there was the certitude that getting the deviceID will be deprecated in further iOS SDK.

I do not understand why Apple want to restrict this, but that's not the topic.

I must prepare my application to an alternative because my users are identified and known for a better use of my app (don't need to log, or create an account, for example). And I'm sure I'm not alone in that case.

So anybody know an alternative from getting the deviceID ? Is there other unique identifier, like MAC address, for example ? How do you prepare your app ?

Community
  • 1
  • 1
Martin
  • 11,881
  • 6
  • 64
  • 110

3 Answers3

5

UPDATE

What about using CFUUID to generate a UUID. You can than store it in KEYCHAIN on the very first launch.. you can get it like this...

NSString *uuid = nil;
CFUUIDRef theUUID = CFUUIDCreate(kCFAllocatorDefault);
if (theUUID) {
  uuid = NSMakeCollectable(CFUUIDCreateString(kCFAllocatorDefault, theUUID));
  [uuid autorelease];
  CFRelease(theUUID);
}

and also by deprecating the uniqueIdentifier method, Apple is suggesting that you don't identify per device but instead per app install. may be tomorrow they might decide to reject your app for doing this .. :/ hoping this helps.

Ankit Srivastava
  • 12,347
  • 11
  • 63
  • 115
  • Thanks, but it wouldn't be the same if the user delete and install again the app (which, i admit, does not occurs often). Another thing, this UUID is generated on a machine, so may not be unique throught our user list on our server. – Martin Mar 09 '12 at 09:39
  • @Martin What about storing the value in keychain...? that wouldn't go away once the app is uninstalled..? and also by deprecating the uniqueIdentifier method, Apple is suggesting that you don't identify per device but instead per app install. may be tomorrow they might decide to reject your app for doing this .. :/ – Ankit Srivastava Mar 09 '12 at 09:49
  • 2
    You could store this UUID created this way in iCloud and then pull from there if you don't have it stored on the device. That would give you a UUID unique to a certain user, which might be what you want? – mattjgalloway Mar 09 '12 at 10:26
  • @Ankit : i never used keychain, thanks for the advice, it sounds cool! However, i don't think it's very important for me to store that ID after reinstall. But one problem remains for me : being sure that the local unique identifier will not conflict with another one after posting on our servers. – Martin Mar 09 '12 at 10:46
  • @mattjgalloway : okay, that's the answer of my second problem. Thanks for the advice ;) – Martin Mar 09 '12 at 10:47
  • @Martin: I was under the impression that UUIDs were unique across disparate systems. There is a chance of creating a duplicate, but the chance is so [minuscule](http://stackoverflow.com/questions/1155008/how-unique-is-uuid), you don't have to worry about it. – lkiss80 Apr 06 '12 at 17:49
2

Please implement the new logic to get Secure UDID.it is provided by Third Party

Learn about free solution:

This really works fine and is easy to implememt without making it a fuss to replace the deprecated method.

Shantanu
  • 3,086
  • 3
  • 25
  • 32
2

try this

- (NSString *)getDeviceID
{
    NSString *uuid = [self gettingString:@"uniqueAppId"];
    if(uuid==nil || [uuid isEqualToString:@""])
    {
        CFUUIDRef theUUID = CFUUIDCreate(kCFAllocatorDefault);
        if (theUUID)
        {
            uuid = NSMakeCollectable(CFUUIDCreateString(kCFAllocatorDefault, theUUID));
            [self savingString:@"uniqueAppId" data:uuid];
            [uuid autorelease];
            CFRelease(theUUID);
        }
    }
    return uuid;

// this is depreciated  
//  UIDevice *device = [UIDevice currentDevice];
//  return [device uniqueIdentifier];
}
hchouhan02
  • 948
  • 1
  • 8
  • 18