0
回答
NSURLConnection同步异步方式下获取status code
利用AWS快速构建适用于生产的无服务器应用程序,免费试用12个月>>>   

首先说说异步方式下的获取

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

再来说说同步方式下的获取

NSHTTPURLResponse* urlResponse = nil;
NSError *error = [[NSError alloc] init];
responseData = [NSURLConnection sendSynchronousRequest:request returningResponse:&urlResponse error:&error];

int statusCode = [urlResponse statusCode];
int errorCode = error.code;





原文链接:http://blog.csdn.net/favormm/article/details/7528089
<无标签>
举报
长平狐
发帖于5年前 0回/631阅
顶部