iOS can be a Bitch
Today I battled an issue with iOS that nearly drove me crazy. What I wanted to do is to call a Apache Sling WebService and retrieve a list of data. I tested it with Curl do make sure it works before dealing with the iOS.
Because I am lazy I did copy some existing code that I knew was working into my project, adjust it and started to test it. But whatever I did I got this error:
Error Domain=kCFErrorDomainCFNetwork Code=303 “The operation couldn’t be completed. (kCFErrorDomainCFNetwork error 303.)”
Can you guess what caused it?
Well, when I ran out of options I just started to take out code until I either ran into other issues or until it fixes it. Eventually I got it working and it turned out that there was a slight change between Sling (very RESTful centric) and the way we did the project which I borrowed the code from. In Sling you need a GET in order to obtain data and in the previous project everything was a POST. But that wasn’t the issue. What was is that I by default gave a payload to the request even if that one was empty. And that is what caused the error. As soon as I took out the payload everything was back to normal. I have to admit that this error code / description was very helpful.
So with Sling I have to make sure that I pay more attention to what HTTP method is used and make the appropriate checks on when certain features can be used.
– Andy
Comments are closed.