我尝试使用此SDWebImageDownloader
方法为Facebook用户提取个人资料照片:
NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"http://graph.facebook.com/%@/picture?width=%@&height=%@", contact[USER_FACEBOOK_ID], @(width).stringValue, @(width).stringValue]];
SDWebImageDownloader *downloader = [SDWebImageDownloader sharedDownloader];
[downloader downloadImageWithURL:url options:0 progress:nil completed:^(UIImage *image, NSData *data, NSError *error, BOOL finished) {
if (image) {
[(UIButton *)view setImage:image forState:UIControlStateNormal];
} else if (error) {
NSLog(@"%@", error);
}
}];
即使我已经跟随this guide from Facebook的每一步,但出于某种原因,我仍然会遇到这个奇怪的错误:
NSErrorFailingURLStringKey=http://graph.facebook.com/XXXXXXXXXXXXXXXX/picture?width=450&height=450, NSErrorFailingURLKey=http://graph.facebook.com/XXXXXXXXXXXXXXXXX/picture?width=450&height=450, NSLocalizedDescription=The resource could not be loaded because the App Transport Security policy requires the use of a secure connection.