I have a big problem with very simple code.
I need to get a picture from a Facebook URL and put it on a UIImageView.
I don’t know but don’t works.
I have tried different links also (no Facebook links also don’t works).
-(IBAction)setUserPhoto:(id)sender{
NSURL *url = [url initWithString:@"http://graph.facebook.com/100000769380612/picture?type=large"];
NSData *imageData = [NSData dataWithContentsOfURL:url];
UIImage *image = [UIImage imageWithData:imageData];
if(image){
NSLog(@"Image OK");
} else if (!image) {
NSLog(@"Error");
}
[userPhoto setImage:image];
}
Thank you.
You are missing something in url..it contain %@ , please replace it with proper string
for eg :
you URL should be some thing like the above one