Though I have imported FacebookSDK like: #import <FacebookSDK/FacebookSDK.h>
, but it says: use of undeclared identifier '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:
The SDK is now composed of three frameworks,
FBSDKCoreKit
,FBSDKLoginKit
, andFBSDKShareKit
.
FBSDKCoreKit
provides core SDK functionality such as Graph API Requests, access tokens, and App Insights.
FBSDKLoginKit
provides functionality to log people in, and only requiresFBSDKCoreKit
.
FBSDKShareKit
provides functionality to share, and only requiresFBSDKCoreKit
.
As for your question:
Requests -
FBSDKGraphRequest
andFBSDKGraphRequestConnection
are inFBSDKCoreKit
and provide helpers to access the Graph API
So basically you need to import FBSDKCoreKit
in your file:
#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.
Then import the below header files into your 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
Eventhough facebook official document is best.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.