Fast Coderz
Fast Coderz

Reputation: 361

Appstore version API is giving different version

I am using this version lookup API for checking the updated version:

https://itunes.apple.com/lookup?bundleId=xxx.yyyyy.zzz

The result is different when i call API from mobile app, Postman and AppStore

from code, it is showing old version in xcode debug 3.0.0: Xcode debug

In Postman it is showing correct version 4.0.0: enter image description here

In AppStore, it is also showing correct version 4.0.0: enter image description here

Why it is not showing correct version when i am calling API from xcode and mobile app? I am using alamofire:

let bundleId = Bundle.main.infoDictionary!["CFBundleIdentifier"] as! String
AF.request("https://itunes.apple.com/lookup?bundleId=\(bundleId)").responseJSON { [weak self] response in
    print(response.result)
}

Upvotes: 2

Views: 1333

Answers (2)

Yogesh Patel
Yogesh Patel

Reputation: 2017

I am facing the same issue and I tried urlRequest.cachePolicy but not working for me.

Below thing is works for me please check URL carefully-

This is my URL-

"http://itunes.apple.com/lookup?bundleId=(bundleId)"

I Changed with this-

"https://itunes.apple.com/lookup?bundleId=(bundleId)"

IF you can see in the first URL I used http and in the second URL, I use https. Please add HTTPS and then check it works. Cheers!

Upvotes: 2

Andrew
Andrew

Reputation: 401

Looks like a caching problem. Try to execute request ignoring cache data

Update: 14.10.2020

let url = "itunes.apple.com/lookup?bundleId=(bundleId)" 
var urlRequest = URLRequest(url: URL(string: url)!) 
urlRequest.cachePolicy = .reloadIgnoringLocalAndRemoteCacheData

Upvotes: 3

Related Questions