15

My APP check update by comparing local version and remote version returned by iTunes lookup API. But the API still return old version after new version has released.

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

This API return new version(4.9) if I request through browser, but return old version(4.8.1) in APP.

Anybody help? Thanks.

- (void)updateAppInfo

{
    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
    //first check iTunes
    NSString *iTunesServiceURL = [NSString stringWithFormat:@"https://itunes.apple.com/us/lookup"];
    iTunesServiceURL = [iTunesServiceURL stringByAppendingFormat:@"?bundleId=%@", [[NSBundle mainBundle] bundleIdentifier]];
    NSLog(@"iRate is checking %@ to retrieve the App Store details...", iTunesServiceURL);

    NSError *error = nil;
    NSURLResponse *response = nil;
    NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:iTunesServiceURL] cachePolicy:NSURLRequestReloadIgnoringLocalCacheData timeoutInterval:60];
    NSData *data = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error];
    NSInteger statusCode = ((NSHTTPURLResponse *)response).statusCode;
    if (data && statusCode == 200)
    {
        //in case error is garbage...
        error = nil;
        id json = nil;
        if ([NSJSONSerialization class])
        {
            json = [[NSJSONSerialization JSONObjectWithData:data options:(NSJSONReadingOptions)0 error:&error][@"results"] lastObject];
        }
        else
        {
            //convert to string
            json = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
        }

        if (!error)
        {
            self.appStoreId = [self valueForKey:@"trackId" inJSON:json];
            self.latestVersion = [self valueForKey:@"version" inJSON:json];
            self.releaseNote = [self valueForKey:@"releaseNotes" inJSON:json];
        }
    }
    });
}
Antony Raphel
  • 2,036
  • 2
  • 25
  • 45
Jack
  • 321
  • 2
  • 9

5 Answers5

25

I was also facing same issue but in my case I was using http (e.g. http://itunes.apple.com/lookup?bundleId=com.xxx.xxxx) so not getting latest app version. Then I replaced http to https (https://itunes.apple.com/lookup?bundleId=com.xxx.xxxx) after that its working for me.

Update - Our team sent mail to apple developers and ask why https is working and http is not working and got reply from apple team. He told "In general, there is a 24 hours delay for updated app information to go from App Store Connect to the public."

For more information see their email reply-enter image description here

Dipak
  • 2,263
  • 1
  • 21
  • 27
2

I'm also having the same issue now. I talked to another developer and he came into the conclusion that it could be a CDN issue. (Content delivery network)

  • When I connect to our wifi, the response is outdated.
  • When I connect to my 4G data, the response is updated.
Vea
  • 101
  • 1
  • 4
1

I was facing the same issue. It has two steps to resolve this issue.

I was using http://itunes.apple.com/lookup?bundleId="YOUR BUNDLE ID" not the https.

Step #1: Please ensure that you are using https not the http because it will not give you the updated version number. First i uploaded my app with version 1.8.0 then version 1.9.0 then version 1.9.1. When i used http it was always showing me 1.8.0 even the app on app store had the version 1.9.1. So, just use https for future.

Step #2: After uploading the latest version please wait for 24 hours in order to get the latest version on https://itunes.apple.com/lookup?bundleId="YOUR BUNDLE ID". I was getting version 1.9.0 even though the app was live with version 1.9.1 within 24 hours. I waited for 24 hours and then it started giving me the correct version and then i was able to force update my app by version checking.

0

Not all apps are available in all countries. In your URL, looking for it in the US store. Remove /us/ and try.

For more details: iTunes search API won't show existing app info

Antony Raphel
  • 2,036
  • 2
  • 25
  • 45
0

Ok @Yunnosch currently not able to fetch application info in JSON format from this url

https://itunes.apple.com/lookup?bundleId="YOUR BUNDLE ID".

Therefore we need to change URL with this

New URL will https://itunes.apple.com/lookup?id="Your Bundle id"

This is just informing new latest url in comment.

Punita
  • 1,338
  • 2
  • 13
  • 21
  • Please make more obvious the additional insight your post contributes, especially in comparison to the answer by Syed Faizan Ahmed. – Yunnosch May 25 '21 at 06:55