- (NSString *)getDeviceIdfa
{
NSString*strUUID = (NSString*)[KeyChainStore load:KEY_USERNAME_PASSWORD];//从我自己钥匙串中获取是否有存入值
//首次执行该方法时,uuid为空
if([strUUID isEqualToString:@""]|| !strUUID)
{
//生成一个uuid的方法
CFUUIDRef uuidRef= CFUUIDCreate(kCFAllocatorDefault);
strUUID = (NSString*)CFBridgingRelease(CFUUIDCreateString(kCFAllocatorDefault,uuidRef));
//将该uuid保存到keychain
[KeyChainStore save:KEY_USERNAME_PASSWORD data:strUUID];
}
return strUUID;
}
网友评论