在Facebook登录期间使用FBSDKApplicationDelegate有什么用?

时间:2016-09-14 08:12:17

标签: swift facebook delegates

在AppDelegate中

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
        FBSDKApplicationDelegate.sharedInstance().application(application, didFinishLaunchingWithOptions: launchOptions)

        return true
    }



    func application(application: UIApplication, openURL url: NSURL, sourceApplication: String?, annotation: AnyObject) -> Bool {

     return FBSDKApplicationDelegate.sharedInstance().application(application, openURL: url, sourceApplication: sourceApplication, annotation: annotation)
    }

 func applicationDidBecomeActive(application: UIApplication) {
        FBSDKAppEvents.activateApp()


    }

即使我没有使用这些方法,登录工作正常 并在我的注销方法

FBSDKAccessToken.setCurrentAccessToken(nil)
        FBSDKProfile.setCurrentProfile(nil)
        loginView.logOut()

然后在AppDelegate类中使用这些方法是什么?

1 个答案:

答案 0 :(得分:2)

通常FBSDKApplicationDelegate后处理来自Facebook登录或Facebook对话的结果(或任何需要切换到本地Facebook应用程序或Safari的操作)。可以在official doc

上找到更多解释