itunes lookup api不通过浏览器

时间:2017-12-07 02:56:33

标签: ios iphone api itunes lookup

我在

中遇到了完全相同的问题

iTunes lookup API return old data in my APP

API:https://itunes.apple.com/kr/lookup?bundleId=com.xxx.xxxx

如果我通过浏览器请求它返回新版本,但是当我在我的APP中检查它时,它会返回旧版本。

有人说它可能是CDN问题但是当我之前更新APP时,它返回了新版本。

- (NSString *)appVersionInfo{NSString *appVersion = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"]; 
return appVersion;}

- (BOOL)compareSameAppVersion{
   NSString *thisAppVersion = [self appVersionInfo];
   NSString *currentAppVersion = nil;
   NSDictionary *infoDic = [[NSBundle mainBundle] infoDictionary];
  NSString *appId = infoDic[@"CFBundleIdentifier"];
   NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:URL_APP_STORE_APTNER_BUNDLE, appId]];
   NSLog(@"%@",url);
   NSData *data = [NSData dataWithContentsOfURL:url];
   NSDictionary *lookup = [NSJSONSerialization JSONObjectWithData:data options:0 error:nil];
   if([lookup[@"resultCount"] integerValue] == 1){
   currentAppVersion = lookup[@"results"][0][@"version"];

   NSLog(@"AppStoreVersion : %@, thisAppVersion : %@", currentAppVersion, thisAppVersion);

   if([currentAppVersion isEqualToString:thisAppVersion]){
       NSLog(@"AppStoreVersion : %@, thisAppVersion : %@", currentAppVersion, thisAppVersion);
       return YES;
   }
   }else{
       return NO;
   }
  return NO;
}

结果是

AppStoreVersion:1.0.5(旧) thisAppVersion:1.0.6(已在app store中新增和更新)

有人帮忙吗?

0 个答案:

没有答案