Skip to content
Permalink
Browse files
CB-10631 ios: Fix for device.uuid in iOS 5.1.1
- Check if identifierForVendor exists and if not create a new UUID
  and store in on the device for future use.
  • Loading branch information
agilethomas committed Feb 16, 2016
1 parent d42fb80 commit b31206dd6566548337a63c26b87f4c03fcaacbad
Showing 1 changed file with 6 additions and 1 deletion.
@@ -55,7 +55,12 @@ - (NSString*)uniqueAppInstanceIdentifier:(UIDevice*)device
// which didn't user identifierForVendor
NSString* app_uuid = [userDefaults stringForKey:UUID_KEY];
if (app_uuid == nil) {
app_uuid = [[device identifierForVendor] UUIDString];
if ([[UIDevice currentDevice] respondsToSelector:@selector(identifierForVendor)]) {
app_uuid = [[device identifierForVendor] UUIDString];
} else {
app_uuid = (__bridge NSString *) CFUUIDCreateString(NULL, CFUUIDCreate(NULL));
}

[userDefaults setObject:app_uuid forKey:UUID_KEY];
[userDefaults synchronize];
}

0 comments on commit b31206d

Please sign in to comment.