FB登录使用Swift 3不返回任何值,并且在成功登录后不会将用户返回到App [英] FB Login using Swift 3 not returning any values and not get back the user to the App after successful login
本文介绍了FB登录使用Swift 3不返回任何值,并且在成功登录后不会将用户返回到App的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用 iOS 10
Swift 3
整合 FB登录
。我已经按照 Facebook
文档中的所有步骤进行操作。现在的问题是,在成功登录后,它不会返回任何值而不会将用户返回到应用程序。
I'm using iOS 10
Swift 3
to integrate FB Login
. I have followed all steps from Facebook
documentation. Now the issue is, after successful login it doesn't returning any values and not get back the user to the app.
注意:同样适用于 Swift 2
。
推荐答案
您好我将这个问题提交给了Facebook开发者支持和问题是我没有为iOS10实现正确的委托方法。并且您可以找到正确的委托实施此处
Hi I raised this issue to facebook developer support and the issue is that I have not implemented the correct delegate methods for iOS10. and you can find the correct delegate implementation here
import UIKit
import CoreData
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
public func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey : Any]? = nil) -> Bool {
// Override point for customization after application launch.
return FBSDKApplicationDelegate.sharedInstance().application(application, didFinishLaunchingWithOptions: launchOptions)
}
public func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any] = [:]) -> Bool {
return FBSDKApplicationDelegate.sharedInstance().application(
app,
open: url as URL!,
sourceApplication: options[UIApplicationOpenURLOptionsKey.sourceApplication] as! String,
annotation: options[UIApplicationOpenURLOptionsKey.annotation]
)
}
public 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)
}
}
这篇关于FB登录使用Swift 3不返回任何值,并且在成功登录后不会将用户返回到App的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文