If I use NSURLConnection to get data from a server and it sends back a response that begins with, say:
HTTP/1.1 406 Some string of text here
Is there any w开发者_如何学JAVAay I can retrieve the status text "Some string of text here"? I know how to get the status code, and I know about localizedStringForStatusCode:, but in this case I need access to the specific text sent back.
You can use ASIHTTPRequest, which provides this as -requestStatusMessage
. Or you can use Core Foundation's CFHTTP
, which provides CFHTTPMessageCopyResponseStatusLine
. I don't believe there's a good way to get to the CFHTTPMessage
from NSHTTPURLResponse
unfortunately. Of course, ASIHTTPRequest
is pretty awesome anyway.
精彩评论