阅读背景:

如何测试sendAsynchronousRequest的部分响应:queue:completionHandler:?

来源:互联网 

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



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: