0

I have a function to call the iTunes API lookup to check the current version on App Store, but the response is always delayed.

func getInfoFromAppStore(_ success: @escaping (_ json: [String: Any?]) -> Void) {
    guard let url = URL(string: "https://itunes.apple.com/lookup?id=xxxx") else {
        return
    }
    session.dataTask(with: url) { (data, urlResponse, error) in
        guard let data = data, error == nil else {
            return
        }

        let responseObject = try? JSONSerialization.jsonObject(with: data, options: [.allowFragments])
        if let json = responseObject as? [String: Any?] {
            success(json)
        }
    }.resume()
}

By exemple: If the old version was 1.0.0, when I uploaded the app 1.0.1 and download it from app store within 2 hours, the version I got from the response json is still 1.0.0. I guess because the server will synchronise all regions...

Is there any way to get the information of the app store associated?

Terry
  • 88
  • 11
  • The App Store says it can take up to 24h to syncronize the data worldwide. So, 2 hours is way too short. – Eric Aya Jan 03 '18 at 16:51
  • @Moritz Thanks for the reply. because if currentVersion != appStoreVersion then it will have a pop-up. Which means if I updated the application already, the pop-up will always show up within 24h... is there any better way to compare the CFBundleShortVersionString? – Terry Jan 03 '18 at 17:27
  • Yeah... don't use (currentVersion != appStoreVersion) use (currentVersion < appStoreVersion). The numbers don't go down. – Dare Jan 03 '18 at 18:51
  • @Dare Yes... I figured that I can use currentVersion.compare method to compare. Thanks! – Terry Jan 04 '18 at 08:51

0 Answers0