Reputation: 4487
I am trying to use FBSession in my Swift project. But I have no idea how to import it.
I have imported these in my Bridging Header
#import <FBSDKCoreKit/FBSDKCoreKit.h>
#import <FBSDKLoginKit/FBSDKLoginKit.h>
Any ideas please?
I am trying to convert the code below to Swift, but I can't seem to use FBSession
// Whenever a person opens app, check for a cached session
if (FBSession.activeSession.state == FBSessionStateCreatedTokenLoaded) {
// If there's one, just open the session silently, without showing the user the login UI
[FBSession openActiveSessionWithReadPermissions:@[@"public_profile"]
allowLoginUI:NO
completionHandler:^(FBSession *session, FBSessionState state, NSError *error) {
// Handler for session state changes
// Call this method EACH time the session state changes,
// NOT just when the session open
[self sessionStateChanged:session state:state error:error];
}];
Upvotes: 1
Views: 636
Reputation: 9912
FBSession
is the name the class had in the 3.x branch of the SDK, the headers you import are from a 4.x version though where that class does not exist anymore.
Facebook has an Upgrade Guide for this in their documentation which will guide you through the process of migrating from 3.x to 4.x
Upvotes: 1