We use Rest API POST call to connect to some external Https endpoints. This worked for years, but not clients on 16.2 have the problem that out of a sudden the calls are blocked.
Then nothing works, and our app thinks it's offline (for this call) but it's not offline since other services are. The only wat to fix this is to Restart the app fully. Then it's working for some while.
Is their something changed in IOS 16, that its blocking an endpoint when you do to many calls? It's for prints and pin payment, so we do calls like this continuously.
Here the error we get when it goes wrong:
Failed with error sessionTaskFailed(error: Error Domain=NSURLErrorDomain Code=-1009 "De internetverbinding is offline." UserInfo={_kCFStreamErrorCodeKey=50, NSUnderlyingError=0x282afcc30 {Error Domain=kCFErrorDomainCFNetwork Code=-1009 "(null)" UserInfo={_NSURLErrorNWPathKey=satisfied (Path is satisfied), interface: en0[802.11], ipv4, dns, _kCFStreamErrorCodeKey=50,
First we did do the call like this:
urlRequest.setValue(self.getToken(), forHTTPHeaderField: "Authorization")
urlRequest.setValue("text/plain", forHTTPHeaderField: "Content-Type")
urlRequest.addValue("application/json", forHTTPHeaderField: "Accept")
urlRequest.httpMethod = "POST"
urlRequest.httpBody = request.data
let config = URLSessionConfiguration.default
config.timeoutIntervalForRequest = TimeInterval(5)
config.timeoutIntervalForResource = TimeInterval(5)
config.waitsForConnectivity = false
let session = URLSession(configuration: config)
let task = session.dataTask(with: urlRequest) { responseData, response, error in
var isPosted = false
if let err = error {
Logger.debug("AWS-Api: \(request.identifer) - Failed with " +
"error \(err), retrying after few seconds")
var newReq = request
newReq.noRetry += 1
self.addRequest(newReq)
} else if let resData = responseData, let res = response {
isPosted = self.processAWSResponse(request.identifer,
data: resData,
postData: request.data,
response: res)
}
session.invalidateAndCancel()
return promise(.success(isPosted))
}
task.resume()
}
To debug we also updated it and use Alomfire. But unfortunately both dont work. In IOS 15 no problems are their.
All the endpoints are https://