首页 > 代码库 > 网络超时的写法

网络超时的写法

网络超时的写法

by 伍雪颖

NSHTTPURLResponse *response = nil;
NSError *error = nil;
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:url]];
request.timeoutInterval = 15;
request.HTTPMethod = @"POST";
NSData *respData = http://www.mamicode.com/[NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error];>

网络超时的写法