FBFriendPickerViewController *friendPicker = [[FBFriendPickerViewController alloc] init];
friendPicker.fieldsForRequest = [[NSSet alloc] initWithObjects:@"picture", nil];
[friendPicker loadData];
[friendPicker presentModallyFromViewController:self
animated:YES
handler:^(FBViewController *sender, BOOL donePressed) {
if (donePressed) {
NSURL *profilePictureURL = [NSURL URLWithString:friend[@"picture"][@"data"][@"url"]];
NSURLRequest *profilePictureURLRequest = [NSURLRequest requestWithURL:profilePictureURL cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:10.0f]; //
NSLog(profilePictureURL.absoluteString);
[NSURLConnection sendAsynchronousRequest:profilePictureURLRequest
queue:[NSOperationQueue mainQueue]
completionHandler:^(NSURLResponse* response, NSData* receivedData, NSError* error)
{
UIimage *userpic = [UIImage imageWithData:receivedData];
}];
网址不为空: https ://fbcdn-profile-a.akamaihd.net/hprofile-ak-ash4/370130_506171594_768019817_q.jpg
但是 receivedData 为零——我尝试了不同的方法从 url 下载数据。
谁能说这段代码有什么问题?这些代码正在运行,但前段时间开始返回 nil 数据。