Reputation: 219
As an object, I have a problem with Alamofire (the same happens with AFNetworking) with an App Distributed internally which I can't debug the real Device; in particular with the iPhone X iOS 12.1.3 and only one device have this problem.
The requests work fine for all Testers, but in one iPhone X, without apparent reason, the Alamofire/AFNetwork, GET/POST, requests stop to come to the Web Service (I have access to real time log of WS and there are no request), but it seems that completion block with Success was called and the App follow the correct flow.
I can't debug this device and I don't know what happens; The Tester does not do any particular action to get this error.
This is one request of the many that do not work; I repeat, all work fine for an hour, after I don't know what happens, kill and reopen the App doesn't work.
Alamofire.request(completePath, method: .get, parameters: nil, encoding: URLEncoding.default, headers: ServiceSupport.sharedInstance.headerAlamofire()).responseJSON { (responseObject) in
if let json = responseObject.result.value {
if(ServiceSupport().headerIsOk(dictResponse: json as! NSDictionary)) {
completion(SUCCESS, "")
} else {
completion(FAIL, "ERROR")
}
} else {
completion(FAIL, "ERROR")
}
}
}
Someone can help me? Has anyone happened? Thanks to all.
Edit: The server should return different data when the request stop coming to WebService; Moreover I have the same problem, with the same Device, with AFNetworking.
Edit 2: Response Header [Response]: { URL: http://******/configuration } { Status Code: 200, Headers { Connection = ( "Keep-Alive" ); "Content-Length" = ( 1060 ); "Content-Type" = ( "application/json;charset=UTF-8" ); Date = ( "Thu, 31 Jan 2019 13:03:23 GMT" ); "Keep-Alive" = ( "timeout=5, max=100" ); Server = ( Apache ); "Set-Cookie" = ( "JSESSIONID=96A0D1E4419A353E6115E34451793951; Path=/; HttpOnly" ); "X-Frame-Options" = ( SAMEORIGIN ); "X-XSS-Protection" = ( "1; mode=block" ); } }
Upvotes: 1
Views: 1352
Reputation: 219
Thanks to all, the problem was the Cache!
URLCache.shared.removeAllCachedResponses()
URLCache.shared = URLCache(memoryCapacity: 0, diskCapacity: 0, diskPath: nil)
This work for me.
Upvotes: 2