Reputation: 311
I am building an iOS application using swift. I use URLSession for API calls. I made all API calls using the ip address and all were working. Now to put the app in store, I changed the ip address to domain name. APIs are working from postman. But in my code its giving the error:
"HTTP load failed (error code: 100 [1:100]), finished with error - code: 100, The operation couldn’t be completed. Protocol error".
I have used arbitrary loads true. I tried "https" and "http" as protocols. What am I missing?
Swift 3
Xcode 9
Testing device iOS 11
EDIT : This problem is not arising if I am using the ip address of the server. Hence I think my request or its format has no errors. The error is coming only when I change IP address to domain name(https://myServerAddress.com).
Upvotes: 2
Views: 4438
Reputation: 473
Error Code description:
100 Continue The client SHOULD continue with its request. This interim response is used to inform the client that the initial part of the request has been received and has not yet been rejected by the server. The client SHOULD continue by sending the remainder of the request or, if the request has already been completed, ignore this response. The server MUST send a final response after the request has been completed. See section 8.2.3 for detailed discussion of the use and handling of this status code.
Seems like either the request does not contain all the data required and hence server is asking to continue to send the remaining data or else the server is not handling the response that has to be provided in a proper way.
I do see this as a possible duplicate of: Error Domain=NSPOSIXErrorDomain Code=100 "Protocol error"
Upvotes: 1