Trying to display the image downloaded from web service to UIImage
, could get the exact image path( by URLString
) and is displayed in NSLog
. Now the problem is imageData
is returning null
value instead of the value to be returned.
The error message is to be printed as :
The operation couldn’t be completed. (Cocoa error 256.)
code used for retrieving the image path are described below,
NSString *urlString = [result objectForKey:@"image"];
NSLog(@"url image is %@ \n",urlString);
NSData *imageData = [[NSData alloc] init];
NSError* error = nil;
imageData = [NSData dataWithContentsOfURL:[NSURL URLWithString:urlString] options:NSDataReadingUncached error:&error];
if (error)
{
NSLog(@"%@", [error localizedDescription]);
}
else
{
NSLog(@"image data is %@ \n",imageData);
imageview.image = [UIImage imageWithData:imageData];
}
What is to be done, for displaying the image in the UIImage
.