I have a really strange problem making a request to https://itunes.apple.com/lookup?id=APPID
If I try this url in my browser it gives me the current version of the app. But if I call this from the iOS app it gives me the old one.
This is the code that I'm using
let stringUrl : String = "https://itunes.apple.com/lookup?id=APPID"
let req : NSMutableURLRequest = NSMutableURLRequest(url: URL(string: stringUrl)!, cachePolicy: NSURLRequest.CachePolicy.reloadIgnoringCacheData, timeoutInterval: 10.0)
req.httpMethod = "get"
let manager = AFHTTPRequestOperationManager()
manager.responseSerializer = AFJSONResponseSerializer()
let r = manager.httpRequestOperation(with: req as URLRequest!,
success: { (operation: AFHTTPRequestOperation?,responseObject: Any?) in
if let responseDic :Dictionary<String, AnyObject> = responseObject as? Dictionary<String, AnyObject> {
let currentVersion: String = Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString") as! String
let results = responseDic.first?.value as! Array<AnyObject>
let dic = results.first as! Dictionary<String,AnyObject>
let version : String = dic["version"] as! String
//let version : String = responseDic.object(forKey: "results")?[0].object(forKey: "version") as! String
self.isUpToDate = currentVersion == version
delegate.onVersionReceived(version)
}
},
failure: { (operation: AFHTTPRequestOperation?,error: Error?) in
})
r.start()
Any idea about what's happening?