1
이미지 식별자를 받아들이고 AFNetworking의 AFImageRequestOperation을 사용하여 이미지를 다운로드하는 편리한 함수를 작성하려고합니다. 이 함수는 이미지를 제대로 다운로드하지만 성공 블록에서 UIImage를 반환 할 수 없습니다. 무슨 일이 일어나고 있는지의AFImageRequestOperation의 성공 블록에서 이미지를 반환
Incompatible block pointer types sending 'UIImage *(^)(NSURLRequest *__strong, NSHTTPURLResponse *__strong, UIImage *__strong)' to parameter of type 'void (^)(NSURLRequest *__strong, NSHTTPURLResponse *__strong, UIImage *__strong)'
어떤 아이디어 :
-(UIImage *)downloadImage:(NSString*)imageIdentifier
{
NSString* urlString = [NSString stringWithFormat:@"http://myserver.com/images/%@", imageIdentifier];
AFImageRequestOperation* operation = [AFImageRequestOperation imageRequestOperationWithRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:urlString]] imageProcessingBlock:nil
success:^(NSURLRequest *request, NSHTTPURLResponse *response, UIImage *image)
{
NSLog(@"response: %@", response);
return image;
}
failure:nil];
[operation start];
}
return image;
라인은 나에게 오류를 제공? 난 그냥 이미지 다운로드 작업이 비동기 AFNetworking
UIImage* photo = [downloadImage:id_12345];