Ios 如何在Swift中导入FBSession.h

Ios 如何在Swift中导入FBSession.h,ios,facebook,swift,facebook-graph-api,Ios,Facebook,Swift,Facebook Graph Api,我试图在我的Swift项目中使用FBSession。但我不知道如何导入它 我已经在我的桥接头中导入了这些 #import <FBSDKCoreKit/FBSDKCoreKit.h> #import <FBSDKLoginKit/FBSDKLoginKit.h> FBSession是该类在SDK的3.x分支中的名称,您导入的标题来自4.x版本,尽管该类不再存在 Facebook在其文档中对此有一个明确的定义,它将指导您完成从3.x到4.x的迁移过程 // Whenever

我试图在我的Swift项目中使用FBSession。但我不知道如何导入它

我已经在我的桥接头中导入了这些

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

FBSession
是该类在SDK的3.x分支中的名称,您导入的标题来自4.x版本,尽管该类不再存在

Facebook在其文档中对此有一个明确的定义,它将指导您完成从3.x到4.x的迁移过程

// 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];
                                }];