0
我在我的鑰匙串保存[[[UIDevice currentDevice] identifierForVendor] UUIDString]
這樣的應用程序:UDID始終從IOS中的鑰匙串返回零數據?
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;
但它給我始終爲零data.its不保存,第一次還,任何人可以幫助我在這?
什麼是錯的,採取[[[的UIDevice currentDevice] identifierForVendor] UUIDString]。我是隻需要那個 – hacker
你在模擬器或真實設備上工作。 –