2012-03-12 113 views
0

我想要獲取Facebook好友的個人資料圖片。我知道我可以通過獲取用戶ID和使用此鏈接代碼來做到這一點:usergraph/picture「> http://graph.facebook.com/ userID/picture。是否有更簡單的方法可以直接從Facebook獲取個人資料圖片SDK?ios,facebook和獲取個人資料圖片

回答

1

怎麼樣獲取資料圖片的網址是什麼?然後使用類似SDWebImage來顯示圖像並將其緩存到設備或任何可以通過傳遞url來顯示和緩存圖像的開源庫?

然後,獲取他朋友的用戶標識秒。將它們保存在NSArray中。然後創建一個fql。

-(void)getFriendsInfo:(NSArray*)userIDs 
{ 
    //prepare param 
    NSMutableString *paramStr = [[NSMutableString alloc]init]; 
     for (int i = 0; i<[userIDs count]; i++) { 
     if ([[userIDs objectAtIndex:i] isKindOfClass:[NSDecimalNumber class]]) { 
     NSString *tempParam = [NSString stringWithString:[[userIDs objectAtIndex:i]stringValue]]; 
     [paramStr appendFormat:@"'%@',", tempParam]; 
    } 
} 
    [paramStr appendFormat:@"%@",@"'9999999999999'"]; 
    NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys: 
           [NSString stringWithFormat:@"SELECT uid, name, pic FROM user WHERE uid IN (%@)", tempParam], @"query", 
           nil]; 

    //in my case, I declared Facebook *facebook; in my app delegate using the latest fb sdk 
    MyAppDelegate *delegate = (MyAppDelegate *) [[UIApplication sharedApplication] delegate]; 
    [[delegate facebook] requestWithMethodName:@"fql.query" 
           andParams:params 
          andHttpMethod:@"POST" 
           andDelegate:self]; 
} 

處理在委託方法的數據

- (void)request:(FBRequest *)request didLoad:(id)result 
2

Facebook的SDK使用相同的用戶名和路徑的圖形。所以我認爲這是不容易。但是,同樣的。

相關問題