1
在我的應用我檢查在AppStore上的版本的顯示器更新正確的消息。
的問題是相同的URL http://itunes.apple.com/lookup?bundleId=my_app_bundle
我稱之爲郵差以及在應用這樣的:應用版本不同的響應
- (void)checkForNewVersion
{
appIsLastVersion = YES;
NSString *bundleIdentifier = [[NSBundle mainBundle] bundleIdentifier];
NSString *currentAppVersion = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"];
NSString *appInfoUrl = [NSString stringWithFormat:@"http://itunes.apple.com/lookup?bundleId=%@", bundleIdentifier];
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init];
[request setURL:[NSURL URLWithString:appInfoUrl]];
[request setHTTPMethod:@"GET"];
NSURLSession *sesion = [NSURLSession sharedSession];
NSURLSessionDataTask *task = [sesion dataTaskWithRequest:request completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) {
NSString *output = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
NSError *e = nil;
NSData *jsonData = [output dataUsingEncoding:NSUTF8StringEncoding];
NSDictionary *jsonDict = [NSJSONSerialization JSONObjectWithData:jsonData options:NSJSONReadingMutableContainers error:&e];
NSArray *results = [jsonDict objectForKey:@"results"];
if (results.count > 0) {
NSString *version = [[[jsonDict objectForKey:@"results"] objectAtIndex:0] objectForKey:@"version"];
appIsLastVersion = [version isEqualToString:currentAppVersion];
[self.tableView reloadData];
}
}];
[task resume];
}
我接收上郵差2不同的響應:
"currentVersionReleaseDate": "2017-03-15T23:14:08Z"
"version": "2.0.1"
和應用
currentVersionReleaseDate = "2017-03-13T07:37:19Z"
version = "2.0.0"
任何解決方案?
對我來說也是這個問題發生。您需要至少等待一天才能讓蘋果服務器同步您的新應用版本詳情。 –