问题描述
为此,我要假装原始网址是 a href =https://tools.ietf.org/html/rfc2616#section-10.3 =nofollow noreferrer> RFC 2616,第10.3节,以了解是否有更好的代码可以使用(当然,检查,当然,iOS处理更好的代码,因为它应该)。
If you control the server, it's worth reading RFC 2616, section 10.3 in its entirety to see if there's a better code you can use (while checking, of course, that iOS handles the better code as it should).
您还可以制作重定向请求的可变拷贝,并替换其HTTP方法与原始请求的HTTP方法。同样的一般原则,虽然这将有利于保持的东西从新的请求,而不是旧的。在某些情况下,这可能会更好,但我还没有测试这个。
You could also make a mutable copy of the redirected request and replace its HTTP method with the HTTP method of the original request. Same general principle, though that would favour keeping things from the new request rather than the old. In some circumstances that might work better, but I haven't tested this yet.
这篇关于使用NSURLConnection正确处理重定向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!