This code is fundamentally flawed. The UIDevice retrieved via +[UIDevice currentDevice] is not initialized, retained, or copied by the calling function, nor does ‘currentDevice’ have the words ‘init’ or ‘copy’ in it. The returned device MUST NOT be released, since it was not retained, initialized, or copied.
Please see http://developer.apple.com/documentation/Cocoa/Conceptual/MemoryMgmt/MemoryMgmt.html and http://developer.apple.com/documentation/Cocoa/Conceptual/MemoryMgmt/Articles/mmRules.html – you should *NOT* release device, as you have not (alloc/new/copy/retain)-ed it.
This code is fundamentally flawed. The UIDevice retrieved via +[UIDevice currentDevice] is not initialized, retained, or copied by the calling function, nor does ‘currentDevice’ have the words ‘init’ or ‘copy’ in it. The returned device MUST NOT be released, since it was not retained, initialized, or copied.
UIDevice *device = [UIDevice currentDevice];
NSString *uniqueIdentifier = [device uniqueIdentifier];
is correct.