[英]FBSDKGraphRequest use of undeclared identifier
Though I have imported FacebookSDK like: #import <FacebookSDK/FacebookSDK.h>
, but it says: use of undeclared identifier 'FBSDKGraphRequest'. 尽管我已经导入了FacebookSDK,例如:
#import <FacebookSDK/FacebookSDK.h>
,但是它说:使用了未声明的标识符'FBSDKGraphRequest'。
The code I wrote is simple: 我写的代码很简单:
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
initWithGraphPath:@"/{user-id}/albums"
parameters:params
HTTPMethod:@"GET"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
id result,
NSError *error) {
// Handle the result
}];
Let me know what may I be missing? 让我知道我可能会丢失什么?
Since version 4.X Facebook has split the SDK in 3 parts: 从版本4.X开始,Facebook将SDK分为3部分:
The SDK is now composed of three frameworks,
FBSDKCoreKit
,FBSDKLoginKit
, andFBSDKShareKit
.该SDK现在由三个框架
FBSDKCoreKit
,FBSDKLoginKit
和FBSDKShareKit
。
FBSDKCoreKit
provides core SDK functionality such as Graph API Requests, access tokens, and App Insights.FBSDKCoreKit
提供了核心的SDK功能,例如Graph API请求,访问令牌和App Insights。
FBSDKLoginKit
provides functionality to log people in, and only requiresFBSDKCoreKit
.FBSDKLoginKit
提供了用于登录人员的功能,只需要FBSDKCoreKit
。
FBSDKShareKit
provides functionality to share, and only requiresFBSDKCoreKit
.FBSDKShareKit
提供了共享功能,只需要FBSDKCoreKit
。
As for your question: 至于你的问题:
Requests -
FBSDKGraphRequest
andFBSDKGraphRequestConnection
are inFBSDKCoreKit
and provide helpers to access the Graph API请求
FBSDKGraphRequest
和FBSDKGraphRequestConnection
在FBSDKCoreKit
并提供帮助程序来访问Graph API
So basically you need to import FBSDKCoreKit
in your file: 因此,基本上,您需要在文件中导入
FBSDKCoreKit
:
#import <FBSDKCoreKit/FBSDKCoreKit.h>
For login into Facebook using new SDK 4.1 You have to add the FBSDKLoginkit and FBSDKCoreKit Frameworks in your project. 要使用新的SDK 4.1登录到Facebook,您必须在项目中添加FBSDKLoginkit和FBSDKCoreKit框架。
Then import the below header files into your ViewController: 然后将以下头文件导入到ViewController中:
#import <FBSDKCoreKit/FBSDKCoreKit.h>
#import <FBSDKLoginKit/FBSDKLoginKit.h>
For more information you can refer the facebook official document here or you can refer these answers 有关更多信息,您可以在此处参考facebook官方文档,也可以参考以下答案
Eventhough facebook official document is best. 尽管facebook官方文件是最好的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.