Retrieve HTTPResponse/HTTPRequest status codes in iOS?

前端 未结 1 932
刺人心
刺人心 2020-12-24 12:13

I need to check and evaluate the HTTP Status Codes in my iPhone app. I\'ve got an NSURLRequest object and an NSURLConnection that successfully (I think) connect to the site:

相关标签:
1条回答
  • 2020-12-24 12:52

    This is how I do it:

        #pragma mark -
        #pragma mark NSURLConnection Delegate Methods
        - (void)connection:(NSURLConnection*)connection didReceiveResponse:(NSURLResponse*)response {
             NSHTTPURLResponse* httpResponse = (NSHTTPURLResponse*)response;
             int responseStatusCode = [httpResponse statusCode];
        }
    

    But I'm using an asynchronous NSURLConnection, so this may not help you. But I hope it does anyway!

    0 讨论(0)
提交回复
热议问题