【发布时间】:2013-12-07 02:39:29
【问题描述】:
假设我有一个给定 URL 返回 UIImage 的方法:
- (void)getUIImageFromURL:(NSURL *)URL {
NSURLRequest *request = [NSURLRequest requestWithURL:URL];
AFHTTPRequestOperation *imageOperation = [[AFHTTPRequestOperation alloc] initWithRequest:request];
imageOperation.responseSerializer = [AFImageResponseSerializer serializer];
[imageOperation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) {
return (UIImage *)responseObject;
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
}];
[imageOperation start];
}
但它一直给我这个错误:
不兼容的块指针类型将“UIImage *(^)(AFHTTPRequestOperation *__strong, _strong id)”发送到“void (^)(AFHTTPRequestOperation *_strong, __strong id)”类型的参数
我对积木有点陌生,所以也许我完全倒退了。我将如何最好地实现这样的方法?
【问题讨论】:
标签: ios objective-c uiimage afnetworking objective-c-blocks