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];
}];
URL が空ではありません: https://fbcdn-profile-a.akamaihd.net/hprofile-ak-ash4/370130_506171594_768019817_q.jpg
しかし、 receivedData は nil — URL からデータをダウンロードするさまざまな方法を試しました。
このコードの何が問題なのか、誰にも言えますか? これらのコードは機能していましたが、しばらく前に nil データを返し始めました。