这是Google-signinFacebook-signin的代码。 Google-signin可以很好地工作,但是Facebook的SDKApplicationDelegate似乎不起作用。我已经导入了我所有的pod(import FacebookCore, Facebook Login, FacebookShare)。

为什么SDKApplication不起作用?

import UIKit
import GoogleSignIn
import FacebookCore

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate, GIDSignInDelegate {
    var window: UIWindow?

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
        GIDSignIn.sharedInstance().clientID = "1043921468178-epj1ms4mnc4tbf2j3vb0kudggfmtnc8b.apps.googleusercontent.com"
        GIDSignIn.sharedInstance().delegate = self
        return SDKApplicationDelegate.shared.application(application, didFinishLaunchingWithOptions: launchOptions)
    }

    func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
        let googleDidHandle = GIDSignIn.sharedInstance().handle(url as URL?,
                                                                sourceApplication: options[UIApplication.OpenURLOptionsKey.sourceApplication] as? String,
                                                                annotation: options[UIApplication.OpenURLOptionsKey.annotation])
        let facebookDidHandle = SDKApplicationDelegate.shared.application(app, open: url, options: options)

         return googleDidHandle || facebookDidHandle
    }

最佳答案

我遇到了同样的问题,找到的解决方案是import FBSDKCoreKit并将其重命名为ApplicationDelegate,但是我所做的是将FacebookCoreFacebookLogin的版本降级为上一个版本(我在使用0.5.0),Facebook SDK似乎有很多关于这个新版本的错误,我建议您也这样做。

关于ios - 使用未解析的标识符“SDKApplicationDelegate”,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/55964287/

10-13 08:00