第三方开源代码
https://github.com/soffes/SAMKeychain
使用方法
//获取设备信息32 位字符串
-(NSString *)getDeviceString{
NSString * deviceUUIDStr = [SAMKeychain passwordForService:@"你的app bundle identifier" account:@"uuid"];
if (deviceUUIDStr == nil || [deviceUUIDStr isEqualToString:@""])
{
deviceUUIDStr = [[[UIDevice currentDevice].identifierForVendor.UUIDString stringByReplacingOccurrencesOfString:@"-" withString:@""] lowercaseString];
[SAMKeychain setPassword: deviceUUIDStr forService:@"你的app bundle identifier"account:@"uuid"];
}
return deviceUUIDStr;
}
原文:http://www.cnblogs.com/rookie-dream/p/5829280.html