So in AFNetworking there is a function as follows:
+ (AFImageRequestOperation *)imageRequestOperationWithRequest:(NSURLRequest *)urlRequest
imageProcessingBlock:(UIImage *(^)(UIImage *))imageProcessingBlock
cacheName:(NSString *)cacheNameOrNil
success:(void (^)(NSURLRequest *request, NSHTTPURLResponse *response, UIImage *image))success
failure:(void (^)(NSURLRequest *request, NSHTTPURLResponse *response, NSError *error))failure
{
I am trying to use it as follows:
[AFImageRequestOperation imageRequestOperationWithRequest:nil imageProcessingBlock:^UIImage * (UIImage *) {
}cacheName:@"nsurl" success:^(NSURLRequest *request, NSHTTPURLResponse * response, UIImage * image){
}failure:^(NSURLRequest *request, NSHTTPURLResponse * response, NSError * error){
}];
However it doesn't seem to be correct in the UIImage part.. any ideas?
You are almost there - your code was missing a parameter name for the image in the first block:
[AFImageRequestOperation imageRequestOperationWithRequest:nil imageProcessingBlock:^UIImage * (UIImage *image) { // <<== HERE
} cacheName:@"nsurl" success:^(NSURLRequest *request, NSHTTPURLResponse * response, UIImage * image){
}failure:^(NSURLRequest *request, NSHTTPURLResponse * response, NSError * error){
}];
I think this is a bug in Xcode, because it expanded the signature into precisely what you posted, without the parameter name.