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是零 - 我尝试了不同的方法从网址下载数据。
有谁可以说这段代码有什么问题?这些代码正在运行,但是不久前开始返回nil数据。