- (void)viewDidLoad
{
NSOperationQueue *operationQueue = [[NSOperationQueue alloc]init];
NSInvocationOperation *downloadImageOperation = [[NSInvocationOperation alloc] initWithTarget:[ImageDownloader getInstance]
selector:@selector(downloadImageSync:)
object:@"image url"];
[operationQueue addOperation:downloadImageOperation];
UIImage *imag = [downloadImageOperation result]; // image is always nil here
imageVIEW.image = imag;
}
Returns the result of the invocation or method. - (id)result Return Value The object returned by the method or an NSValue object containing the return value if it is not an object. If the method or invocation is not finished executing, this method returns nil.
I always get nil
for the image.
What's wrong with the above code?