[英]How to import FBSession.h in Swift
我正在尝试在我的Swift项目中使用FBSession。 但是我不知道如何导入它。
我已将这些导入到我的桥接头中
#import <FBSDKCoreKit/FBSDKCoreKit.h>
#import <FBSDKLoginKit/FBSDKLoginKit.h>
有什么想法吗?
我正在尝试将下面的代码转换为Swift,但似乎无法使用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];
}];
FBSession
是该类在SDK的3.x分支中使用的名称,虽然该类不再存在,但您导入的标头来自4.x版本。
Facebook在其文档中对此有一个升级指南 ,它将指导您完成从3.x到4.x迁移的过程。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.