2015-04-01 36 views
0

我需要用戶好友列表。我明白如何從應用程序按鈕登錄到FB。但現在我不能碰到這條線:要在iOS中使用Facebook Graph API導入什麼內容?

我應該導入哪個頭文件來使用Graph API?

/* make the API call */ 
[FBRequestConnection startWithGraphPath:@"/{friendlist-id}" 
         completionHandler:^(
          FBRequestConnection *connection, 
          id result, 
          NSError *error 

我安裝的框架見下文,幷包括一些標題。但看不到任何圖表的東西。

#import <FBSDKCoreKit/FBSDKCoreKit.h> 
#import <FBSDKCoreKit/FBSDKCoreKit.h> 
#import <FBSDKLoginKit/FBSDKLoginKit.h> 

enter image description here

+0

其SDK您使用的? – 2015-04-01 14:25:15

+0

FacebookSDK for iOS – 2015-04-01 14:26:37

+0

版本?是不是4.0 – 2015-04-01 14:27:17

回答

1

,因爲它是在SDK 4.0

[[[FBSDKGraphRequest alloc] initWithGraphPath:@"/me/friends" parameters:nil] 
    startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) { 
     if (!error) { 
     NSLog(@」fetched user:%@」, result); 
     } 
    }]; 

更新嘗試使用這種方法請參考:https://developers.facebook.com/docs/ios/graph#fetching

+0

你有沒有收到你的朋友名單? – 2015-04-02 04:51:17

+0

當我聲明FBSDKGraphRequest *請求時,它說'使用未識別的標識符FBSDKGraphRequest'。雖然我也導入了,但可能是什麼問題? – 2015-05-21 12:54:02

+0

@ChanchalRaj嘗試使用#import ,因爲它在更新的版本中被更改 – 2015-05-21 13:24:47