Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

-1103 Error Domain=NSURLErrorDomain Code=-1103 "resource exceeds maximum size" iOS 13

We are facing the following networking error when the response is somehow large(14kb) on iOS 13.

[-1103] Error Domain=NSURLErrorDomain Code=-1103 "resource exceeds maximum size"

As we are using Alamofire, this problem is treated as error result which breaks our treatments of the results.

The strange thing is that if we use NSURLSession directly, though this error is still seen from logging, we don't actually receive it in the callback of

session.dataTask(with: request) { value, response, error in ... }

So the result can treated correctly.

This problem is never seen before. Anyone has got some idea on that ?

like image 943
Jibeex Avatar asked Jul 09 '19 15:07

Jibeex


3 Answers

With the help of the Slack community, we find the answer is that on iOS13, it is not allowed to add a body in GET request. To make it work again, we can either switch to a POST/PUT request or add body value via url parameters of the GET request.

like image 147
Jibeex Avatar answered Nov 19 '22 20:11

Jibeex


Pass query parameters in GET request like the following:

let parameters: Parameters = [
    "param": value
]
Alamofire.request(urlString, method: .get, parameters: parameters, encoding: URLEncoding.queryString)
like image 31
smartwolf Avatar answered Nov 19 '22 19:11

smartwolf


I have face same issue and find out the solution.

You can't pass parameter in body while using GET.

Either use POST method if API support or pass it in URL like below.

AnyURL?Parameter=Value&Parameter=Value

like image 14
Hardik Vyas Avatar answered Nov 19 '22 18:11

Hardik Vyas