码迷,mamicode.com
首页 > 其他好文 > 详细

网络超时的写法

时间:2014-09-29 12:34:10      阅读:127      评论:0      收藏:0      [点我收藏+]

标签:ios   network   

网络超时的写法

by 伍雪颖

NSHTTPURLResponse *response = nil;
NSError *error = nil;
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:url]];
request.timeoutInterval = 15;
request.HTTPMethod = @"POST";
NSData *respData = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error];
if (error) {
    NSLog(@"error");
    [ZAActivityBar showErrorWithStatus:@"Network unavailabel! Please try again!"];
}


网络超时的写法

标签:ios   network   

原文地址:http://blog.csdn.net/rainlesvio/article/details/39665649

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!