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!"];
}原文:http://www.cnblogs.com/yxwkf/p/5162085.html