에서있는 UIImage를 반환 나는 다음과 같은 코드를 가지고 :블록
- (UIImage *) getPublisherLogo
{
//check the cache if the logo already exists
NSString * imageUrl = [NSString stringWithFormat:@"%@/%@&image_type=icon", self.baseUrl, self.imageUrl_];
ASIHTTPRequest * imageRequest = [ASIHTTPRequest requestWithURL:[NSURL URLWithString:imageUrl]];
[imageRequest setTimeOutSeconds:30.0];
[imageRequest setDownloadCache:[ASIDownloadCache sharedCache]];
[imageRequest setCacheStoragePolicy:ASICachePermanentlyCacheStoragePolicy];
[imageRequest setCachePolicy:ASIAskServerIfModifiedWhenStaleCachePolicy|ASIFallbackToCacheIfLoadFailsCachePolicy];
[imageRequest setCompletionBlock:^(void){
UIImage *img = [UIImage imageWithData:[imageRequest responseData] ];
if (img){
return img;
}
}];
[imageRequest setFailedBlock:^(void){
NSLog(@"Error in pulling image for publisher %@", [[imageRequest error] userInfo]);
}];
[imageRequest startAsynchronous];
}
}
문제는 반환 값이 /있는 UIImage가 블록에 돌려 주어집니다. 어떻게 이것을 피할 수 있습니까?
메서드는 "publisherLogo"여야합니다. 그것은'get' 접두어를 가져서는 안됩니다. – bbum