J'ai deux modules installés pour la connexion à Facebook
pod 'FacebookCore'
pod 'FacebookLogin'
que FacebookCore importé dans appdelegate. il montre toujours l'utilisation d'une erreur d'identification non résolue.
J'ai également implémenté des balises dans info.plist
<array>
<string>fb---------</string>
</array>
<key>FacebookAppID</key>
<string>-----------</string>
<key>FacebookDisplayName</key>
<string>-----------</string>
Toujours pas en mesure d'obtenir SDKApplicationDelegate.
func application(_ app: UIApplication, open url: URL,
options: [UIApplication.OpenURLOptionsKey: Any]) -> Bool {
if SDKApplicationDelegate.shared.application(app, open: url, options: options) {
return true
}
return false
}
C'est parce que SDKApplicationDelegate
est remplacé par ApplicationDelegate
func application(_ app: UIApplication, open url: URL,
options: [UIApplication.OpenURLOptionsKey: Any]) -> Bool {
if ApplicationDelegate.shared.application(app, open: url, options: options) {
return true
}
return false
}
Encore une chose à faire
class AppDelegate: UIResponder, UIApplicationDelegate
Importez également ces deux pods
import FBSDKCoreKit
import FBSDKLoginKit
remplacez simplement SDKApplicationDelegate
par ApplicationDelegate
import FacebookCore
//....
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
ApplicationDelegate.shared.application(application, didFinishLaunchingWithOptions: launchOptions)
return true
}
//....
func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any]) -> Bool {
guard let urlScheme = url.scheme else { return false }
if urlScheme.hasPrefix("fb") {
return ApplicationDelegate.shared.application(app, open: url, options: options)
}
return true
}
Pour pouvoir vous connecter à Facebook, ajoutez ces 2 méthodes
func application(_ app: UIApplication,open url: URL,options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool{
if #available(iOS 9.0, *) {
let sourceApplication: String? = options[UIApplication.OpenURLOptionsKey.sourceApplication] as? String
return FBSDKApplicationDelegate.sharedInstance().application(app, open: url,sourceApplication: sourceApplication, annotation: nil)
}
return true
}
func application(_ application: UIApplication, open url: URL, sourceApplication: String?, annotation: Any) -> Bool {
return FBSDKApplicationDelegate.sharedInstance().application(application, open: url as URL?, sourceApplication: sourceApplication, annotation: annotation)
}
import FBSDKCoreKit
import FBSDKLoginKit