I have the following code:
我有以下代码:
NSURLRequest *theRequest=[NSURLRequest requestWithURL:[NSURL URLWithString:@"https://some-example-domain.com/api"]
cachePolicy:NSURLRequestReloadIgnoringLocalAndRemoteCacheData
timeoutInterval:30.0];
[NSURLConnection sendAsynchronousRequest:theRequest
queue: [NSOperationQueue mainQueue]
completionHandler:^(NSURLResponse *response, NSData *data, NSError *error) {
if (!error && data) {
// success!! - no errors and data returned
NSLog(@"success");
} else {
// error!! - something whent wrong
NSLog(@"failure: %@", [error localizedDescription]);
}
}
];
NSURLReq