繁体   English   中英

如何在 iOS 14(SwiftUI) 小部件扩展中初始化 Facebook SDK?

[英]How to initialise Facebook SDK in iOS 14(SwiftUI) Widget Extension?

如何在 iOS 14(SwiftUI) 小部件扩展中初始化 Facebook SDK? 我需要在哪里调用以下方法?

ApplicationDelegate.shared.application( application, didFinishLaunchingWithOptions: launchOptions)  

我的最终目标是从我的小部件中调用 GraphRequest。 根据文档,要调用图形请求,我们需要先初始化 Facebook SDK。

提前致谢!

只有一个小提示:如果您从头开始编写应用程序并认为您将需要 Appdelegate 逻辑,您可以在开始时使用 select:

在此处输入图像描述

你在哪里得到:

@main
class AppDelegate: UIResponder, UIApplicationDelegate {


    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
        // Override point for customization after application launch.
        return true
    }

    // MARK: UISceneSession Lifecycle

    func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
        // Called when a new scene session is being created.
        // Use this method to select a configuration to create the new scene with.
        return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
    }

    func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) {
        // Called when the user discards a scene session.
        // If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.
        // Use this method to release any resources that were specific to the discarded scenes, as they will not return.
    }


}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM