2012-06-26 31 views
1

我有我的應用程序設置這些Facebook的權限:Facebook SDK加載默認圖像,而不是從我的個人資料圖像,爲什麼?

NSArray *permissions = [[NSArray alloc] initWithObjects: 
            @"user_games_activity", 
            @"friends_games_activity", 
            @"publish_actions", 
            @"user_photos", 
            nil]; 
      [[myDelegate facebook] authorize:permissions]; 

我做的請求,像這樣:

NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:@"name,picture",@"fields",nil]; 
    [[delegate facebook] requestWithGraphPath:@"me" andParams:params andDelegate:self]; 

和處理類似的迴應:

else if([request.url rangeOfString:@"me"].location != NSNotFound) 
    { 
     NSString *username = [result objectForKey:@"name"]; 
     NSLog(@"We think the username is %@", username); 
     helloGreeting.text = [NSString stringWithFormat:@"Hello %@", username]; 


     NSString *pictureUrl = [result objectForKey:@"picture"]; 
     NSLog(@"Now loading image [%@]", pictureUrl); 
     NSData *data = [NSData dataWithContentsOfURL:[NSURL URLWithString:pictureUrl]]; 
     profilePhoto.image = [UIImage imageWithData:data]; 
    } 

我得到的日誌輸出是:

2012-06-26 15:10:49.002 FacebookIntegrator[10549:f803] We think the username is James Elsey 
2012-06-26 15:10:49.003 FacebookIntegrator[10549:f803] Now loading image [http://profile.ak.fbcdn.net/static-ak/rsrc.php/v2/yo/r/UlIqmHJn-SK.gif] 

enter image description here

問題:爲什麼它獲得默認通用的Facebook圖標,而不是我自己的個人資料圖片?使用上Graph Explorer相同的訪問令牌,我可以得到我的個人資料圖片圖像URL

documentationuser_photos狀態:

提供對用戶上傳的照片,照片 用戶已

回答

1

用戶頭像不需要user_photos權限。圖片可能來自Facebook緩存,你應該使用下面的網址爲圖片。

http://graph.facebook.com/<facebook id>/picture 
相關問題