用独立的钥匙链存储设备信息,避免冲突。review by 海哥。
Showing
1 changed file
with
5 additions
and
3 deletions
@@ -68,6 +68,8 @@ static NSString * const kOpenUDIDSlotPBPrefix = @"org.OpenUDID.slot."; | @@ -68,6 +68,8 @@ static NSString * const kOpenUDIDSlotPBPrefix = @"org.OpenUDID.slot."; | ||
68 | static int const kOpenUDIDRedundancySlots = 100; | 68 | static int const kOpenUDIDRedundancySlots = 100; |
69 | static NSString * const kYohoSecretInfo = @"com.yoho.buy.secretinfo"; | 69 | static NSString * const kYohoSecretInfo = @"com.yoho.buy.secretinfo"; |
70 | static NSString * const kYohoBuyUdid = @"com.yoho.buy.udid"; | 70 | static NSString * const kYohoBuyUdid = @"com.yoho.buy.udid"; |
71 | + | ||
72 | +static NSString * const kYohoDeviceInfo = @"com.yoho.buy.deviceinfo"; | ||
71 | static NSString * const kYohoBuyUsedDevice = @"com.yoho.buy.useddevice"; | 73 | static NSString * const kYohoBuyUsedDevice = @"com.yoho.buy.useddevice"; |
72 | 74 | ||
73 | @interface OpenUDID (Private) | 75 | @interface OpenUDID (Private) |
@@ -395,14 +397,14 @@ static NSString * const kYohoBuyUsedDevice = @"com.yoho.buy.useddevice"; | @@ -395,14 +397,14 @@ static NSString * const kYohoBuyUsedDevice = @"com.yoho.buy.useddevice"; | ||
395 | 397 | ||
396 | + (void) setUsedDevice | 398 | + (void) setUsedDevice |
397 | { | 399 | { |
398 | - NSMutableDictionary *yohoinfoKVPairs = (NSMutableDictionary *)[YH_KeychainStore load:kYohoSecretInfo]; | 400 | + NSMutableDictionary *yohoinfoKVPairs = (NSMutableDictionary *)[YH_KeychainStore load:kYohoDeviceInfo]; |
399 | if (yohoinfoKVPairs == nil) { | 401 | if (yohoinfoKVPairs == nil) { |
400 | yohoinfoKVPairs = [NSMutableDictionary dictionary]; | 402 | yohoinfoKVPairs = [NSMutableDictionary dictionary]; |
401 | } | 403 | } |
402 | 404 | ||
403 | if (![yohoinfoKVPairs[kYohoBuyUsedDevice] isEqualToString:@"Y"]) { | 405 | if (![yohoinfoKVPairs[kYohoBuyUsedDevice] isEqualToString:@"Y"]) { |
404 | [yohoinfoKVPairs setObject:@"Y" forKey:kYohoBuyUsedDevice]; | 406 | [yohoinfoKVPairs setObject:@"Y" forKey:kYohoBuyUsedDevice]; |
405 | - [YH_KeychainStore save:kYohoSecretInfo data:yohoinfoKVPairs]; | 407 | + [YH_KeychainStore save:kYohoDeviceInfo data:yohoinfoKVPairs]; |
406 | } | 408 | } |
407 | } | 409 | } |
408 | 410 | ||
@@ -413,7 +415,7 @@ static NSString * const kYohoBuyUsedDevice = @"com.yoho.buy.useddevice"; | @@ -413,7 +415,7 @@ static NSString * const kYohoBuyUsedDevice = @"com.yoho.buy.useddevice"; | ||
413 | return NO; | 415 | return NO; |
414 | } | 416 | } |
415 | 417 | ||
416 | - NSMutableDictionary *yohoinfoKVPairs = (NSMutableDictionary *)[YH_KeychainStore load:kYohoSecretInfo]; | 418 | + NSMutableDictionary *yohoinfoKVPairs = (NSMutableDictionary *)[YH_KeychainStore load:kYohoDeviceInfo]; |
417 | if (yohoinfoKVPairs == nil || yohoinfoKVPairs[kYohoBuyUsedDevice] == nil) { | 419 | if (yohoinfoKVPairs == nil || yohoinfoKVPairs[kYohoBuyUsedDevice] == nil) { |
418 | return YES; | 420 | return YES; |
419 | } else { | 421 | } else { |
-
Please register or login to post a comment