0
我的应用必须从Facebook下载个人资料图片。我写信给下载图像的代码工作得很好用具有直接链接(例如:http://www.mydomain.com/profile_picture.png)图像URLAFImageRequestOperation产生错误
但对于Facebook的网址(例如:http://graph.facebook.com/100000741043402/picture)产生一个错误
以下是代码:
NSURLRequest *imageRequest = [NSURLRequest requestWithURL:[NSURL URLWithString:imageUrl] cachePolicy:NSURLRequestReturnCacheDataDontLoad timeoutInterval:30.0];
AFImageRequestOperation *operation = [AFImageRequestOperation imageRequestOperationWithRequest:imageRequest
imageProcessingBlock:nil
cacheName:@"nscache"
success:^(NSURLRequest *request, NSHTTPURLResponse *response, UIImage *image){ profilePicture.image = image;
[profilePicture.layer setBorderColor: [[UIColor colorWithRed:137.0/255.0 green:137.0/255.0 blue:137.0/255.0 alpha:1.0] CGColor]];
[profilePicture.layer setBorderWidth: 2.0];
}
failure:^(NSURLRequest *request, NSHTTPURLResponse *response, NSError *error){ NSLog(@"%@",[error description]); }
];
[operation start];
而且下面是回响:
Error Domain=NSURLErrorDomain Code=-1008 "resource unavailable" UserInfo=0x97e0ae0 {NSErrorFailingURLStringKey=http://graph.facebook.com/100000741043402/picture, NSErrorFailingURLKey=http://graph.facebook.com/100000741043402/picture, NSLocalizedDescription=resource unavailable, NSUnderlyingError=0xa3559b0 "resource unavailable"}
任何提示/建议将高度赞赏。