Authored by 周蓉君

用独立的钥匙链存储设备信息,避免冲突。review by 海哥。

... ... @@ -68,6 +68,8 @@ static NSString * const kOpenUDIDSlotPBPrefix = @"org.OpenUDID.slot.";
static int const kOpenUDIDRedundancySlots = 100;
static NSString * const kYohoSecretInfo = @"com.yoho.buy.secretinfo";
static NSString * const kYohoBuyUdid = @"com.yoho.buy.udid";
static NSString * const kYohoDeviceInfo = @"com.yoho.buy.deviceinfo";
static NSString * const kYohoBuyUsedDevice = @"com.yoho.buy.useddevice";
@interface OpenUDID (Private)
... ... @@ -395,14 +397,14 @@ static NSString * const kYohoBuyUsedDevice = @"com.yoho.buy.useddevice";
+ (void) setUsedDevice
{
NSMutableDictionary *yohoinfoKVPairs = (NSMutableDictionary *)[YH_KeychainStore load:kYohoSecretInfo];
NSMutableDictionary *yohoinfoKVPairs = (NSMutableDictionary *)[YH_KeychainStore load:kYohoDeviceInfo];
if (yohoinfoKVPairs == nil) {
yohoinfoKVPairs = [NSMutableDictionary dictionary];
}
if (![yohoinfoKVPairs[kYohoBuyUsedDevice] isEqualToString:@"Y"]) {
[yohoinfoKVPairs setObject:@"Y" forKey:kYohoBuyUsedDevice];
[YH_KeychainStore save:kYohoSecretInfo data:yohoinfoKVPairs];
[YH_KeychainStore save:kYohoDeviceInfo data:yohoinfoKVPairs];
}
}
... ... @@ -413,7 +415,7 @@ static NSString * const kYohoBuyUsedDevice = @"com.yoho.buy.useddevice";
return NO;
}
NSMutableDictionary *yohoinfoKVPairs = (NSMutableDictionary *)[YH_KeychainStore load:kYohoSecretInfo];
NSMutableDictionary *yohoinfoKVPairs = (NSMutableDictionary *)[YH_KeychainStore load:kYohoDeviceInfo];
if (yohoinfoKVPairs == nil || yohoinfoKVPairs[kYohoBuyUsedDevice] == nil) {
return YES;
} else {
... ...