1
我想在我的Swift項目中使用FBSession。但我不知道如何導入它。如何導入Swift中的FBSession.h
我在橋接報
#import <FBSDKCoreKit/FBSDKCoreKit.h>
#import <FBSDKLoginKit/FBSDKLoginKit.h>
任何想法進口這些嗎?
我試圖將代碼轉換下面斯威夫特,但我似乎無法使用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];
}];