完成处理程序完成后如何返回数据?我试过这个方法,但它显示一个错误:
- (NSData *)ReturnDataFromUrl{
NSURLRequest *req = [NSURLRequest requestWithURL:[NSURL URLWithString:@"http://example.com"]];
[NSURLConnection sendAsynchronousRequest:req queue:[NSOperationQueue mainQueue] completionHandler:^(NSURLResponse *response, NSData *data, NSError *error) {
return data;
}];
}