iOS 6同iPhone5岀左之後,終於“的“起心肝去update下d apps.

普遍都唔太大問題,不過就想用盡個iPhone5長長的Screen.

Apple係iOS 5已經deprecate左 [UIDevice uniqueIdentifier]. The 40 character hex string that uniquely identifies each device.

既然遲早都無,唯有自已gen啦,最後take呢個approach。

NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];

if ([defaults objectForKey:@”UUID”] == nil)
{
CFUUIDRef uuid = CFUUIDCreate(kCFAllocatorDefault);

NSString *uuidString = (NSString*)CFUUIDCreateString(kCFAllocatorDefault, uuid);

CFRelease(uuid);

[defaults setObject:[uuidString autorelease] forKey:@”UUID”];
[defaults synchronize];
}