Authored by 周蓉君

Merge branch 'master' into yoho

@@ -28,8 +28,8 @@ @@ -28,8 +28,8 @@
28 self = [super initWithDataType:YHItemDataTypeStatus]; 28 self = [super initWithDataType:YHItemDataTypeStatus];
29 if (self) { 29 if (self) {
30 self.net = @"0"; 30 self.net = @"0";
31 - self.av = [[[NSBundle mainBundle] infoDictionary]objectForKey:@"CFBundleShortVersionString"];  
32 - self.ab = [[NSBundle mainBundle] objectForInfoDictionaryKey: (NSString *)kCFBundleVersionKey]; 31 + self.av = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"];
  32 + self.ab = [[NSBundle mainBundle] objectForInfoDictionaryKey:(__bridge NSString *)kCFBundleVersionKey];
33 self.la = [[NSNumber numberWithDouble:kCLLocationCoordinate2DInvalid.latitude] stringValue]; 33 self.la = [[NSNumber numberWithDouble:kCLLocationCoordinate2DInvalid.latitude] stringValue];
34 self.lo = [[NSNumber numberWithDouble:kCLLocationCoordinate2DInvalid.longitude] stringValue]; 34 self.lo = [[NSNumber numberWithDouble:kCLLocationCoordinate2DInvalid.longitude] stringValue];
35 self.udid = [OpenUDID value]; 35 self.udid = [OpenUDID value];
@@ -66,8 +66,8 @@ static NSString * const kOpenUDIDOOTSKey = @"OpenUDID_optOutTS"; @@ -66,8 +66,8 @@ static NSString * const kOpenUDIDOOTSKey = @"OpenUDID_optOutTS";
66 static NSString * const kOpenUDIDDomain = @"org.OpenUDID"; 66 static NSString * const kOpenUDIDDomain = @"org.OpenUDID";
67 static NSString * const kOpenUDIDSlotPBPrefix = @"org.OpenUDID.slot."; 67 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";  
70 -static NSString * const kYohoBuyUdid = @"com.yoho.buy.udid"; 69 +static NSString * const kYohoSecretInfo = @"secretinfo";
  70 +static NSString * const kYohoBuyUdid = @"udid";
71 71
72 static BOOL isNew = YES; 72 static BOOL isNew = YES;
73 static NSString * const kYohoDeviceInfo = @"com.yoho.buy.deviceinfo"; 73 static NSString * const kYohoDeviceInfo = @"com.yoho.buy.deviceinfo";
@@ -168,14 +168,18 @@ static NSString * const kYohoBuyFirstLaunch = @"com.yoho.buy.firstlaunch"; @@ -168,14 +168,18 @@ static NSString * const kYohoBuyFirstLaunch = @"com.yoho.buy.firstlaunch";
168 static NSString * shareUdidString = nil; 168 static NSString * shareUdidString = nil;
169 static dispatch_once_t onceToken; 169 static dispatch_once_t onceToken;
170 dispatch_once(&onceToken, ^{ 170 dispatch_once(&onceToken, ^{
171 - NSMutableDictionary *keychainnamepasswordKVPairs = (NSMutableDictionary *)[YH_KeychainStore load:kYohoSecretInfo];  
172 - NSString * udidString = [keychainnamepasswordKVPairs objectForKey:kYohoBuyUdid]; 171 + NSString *bundleId = [[[NSBundle mainBundle] infoDictionary] objectForKey:(__bridge NSString *)kCFBundleIdentifierKey];
  172 + NSString *secretInfoKey = [NSString stringWithFormat:@"%@.%@", bundleId, kYohoSecretInfo];
  173 + NSString *appUdidKey = [NSString stringWithFormat:@"%@.%@", bundleId, kYohoBuyUdid];
  174 +
  175 + NSMutableDictionary *keychainnamepasswordKVPairs = (NSMutableDictionary *)[YH_KeychainStore load:secretInfoKey];
  176 + NSString * udidString = [keychainnamepasswordKVPairs objectForKey:appUdidKey];
173 177
174 if (udidString == nil || udidString.length == 0) { 178 if (udidString == nil || udidString.length == 0) {
175 - NSString* lvstring = [OpenUDID valueWithError:nil]; 179 + NSString * lvstring = [OpenUDID valueWithError:nil];
176 NSMutableDictionary * yohoinfoKVPairs = [NSMutableDictionary dictionary]; 180 NSMutableDictionary * yohoinfoKVPairs = [NSMutableDictionary dictionary];
177 - [yohoinfoKVPairs setObject:lvstring forKey:kYohoBuyUdid];  
178 - [YH_KeychainStore save:kYohoSecretInfo data:yohoinfoKVPairs]; 181 + [yohoinfoKVPairs setObject:lvstring forKey:appUdidKey];
  182 + [YH_KeychainStore save:secretInfoKey data:yohoinfoKVPairs];
179 udidString = lvstring; 183 udidString = lvstring;
180 } 184 }
181 shareUdidString = [NSString stringWithString:udidString]; 185 shareUdidString = [NSString stringWithString:udidString];