Can't get correct version on App Store

Hello i develop my app which has version check function.


When my app get version with source code on App Store, verison is previous version and all data are too,


but my app's version distributed on App Store is 1.34.


I checked the version with url on Chrome Web Browser, and it was 1.34.


url: http://itunes.apple.com/lookup?bundleId=smart.edutrack.co.kr


What's wrong with this?



Here's my source code.

----------------------------------------------------------------------

guard


let version = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String,


let url = URL(string: "http://itunes.apple.com/lookup?bundleId=smart.edutrack.co.kr"),


let data = try? Data(contentsOf: url),


let json = try? JSONSerialization.jsonObject(with: data, options: .allowFragments) as? [String: Any],


let results = json?["results"] as? [[String: Any]],


results.count > 0,


let appStoreVersion = results[0]["version"] as? String


else { return false }

print(results)

print("presentVersion: \(version)")

print("appStoreVersion: \(appStoreVersion)")

if !(version == appStoreVersion) { return true }

----------------------------------------------------------------------

Replies

Faced same issue recently. Both app and Postman. There is caching somewhere on network layer. Haven't found where exactly

What I have done to solve it:

I have added extra GET parameter 'date' with Date.init().timeIntervalSince1970 value

As result, url looks like:

var url: String { http://itunes.apple.com/lookup?bundleId={bundle}&date=\(Date.init().timeIntervalSince1970) }

which gives me unique url every time I use it.

I know, it's not the best way, bcs it's not solving the reason but helped to solve the resulting problem