NSError *error = nil;
NSURL *url = [NSURL URLWithString:[imageLinks objectAtIndex:0]];
NSData *tdata = [NSData dataWithContentsOfURL:url options:NSDataReadingUncached error:&error];
if (error) {
NSLog(@"%@", [error localizedDescription]);
}else {
// no error, this one is being called within my app
NSLog(@"Data loaded successfully");
}
self.pictureView1.image = [UIImage imageWithData:tdata];
I have a jpeg file, I can confirm that the URL content is gathered successfully, but when I try to put my image data into the UIImage
my app fails. I wonder if there is any check for NSData to confirm it is usable for UIImage
.
I also don't know what causes this failure, and how to prevent it. Any help would be appreciated.
nil
or not to see if the data really can be used as image. As to why it fails, there is too little information to even guess the reason. Can you post the log for printing out NSData received? – Behnken