我有一个应用程序,我在其中保存[[[UIDevice currentDevice] identifierForVendor] UUIDString]
了这样的钥匙串:
NSString *bundleId = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleIdentifier"];
NSString *strApplicationUUID;
if(![keychainItem objectForKey:(__bridge id)(kSecValueData)]){
NSString *idfa = [[[UIDevice currentDevice] identifierForVendor] UUIDString];
NSLog(@"bundleId %@",idfa);
[keychainItem setObject:idfa forKey:(__bridge id)(kSecValueData)];
NSLog(@"saving item %@", [keychainItem objectForKey:(__bridge id)(kSecValueData)]);
strApplicationUUID=[keychainItem objectForKey:(__bridge id)(kSecValueData)];
}else{
NSLog(@"saved item is %@", [keychainItem objectForKey:(__bridge id)(kSecValueData)]);
strApplicationUUID=[keychainItem objectForKey:(__bridge id)(kSecValueData)];
}
// NSString *strApplicationUUIDstr = [[NSString alloc] initWithData:[keychainItem objectForKey:(__bridge id)(kSecValueData)]
//encoding:NSUTF8StringEncoding];
NSLog(@"%@",strApplicationUUIDstr);
NSLog(@"%@",strApplicationUUID);
return strApplicationUUID;
但它总是给我零数据。它也不是第一次保存,有人可以帮我吗?