我正在尝试在我的项目中实现 Snapchat 登录按钮。我已经下载了 SDK,创建了 Snapchat 开发者帐户,并在 info.plist 中编写了一些代码。
现在我可以登录 Snapchat 帐户,但当我单击返回应用程序时,我收到 404 未找到错误页面。我认为问题出在这个函数上,因为当我点击后退按钮时它不起作用:
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
FBSDKApplicationDelegate.sharedInstance()?.application(application, didFinishLaunchingWithOptions: launchOptions)
TWTRTwitter.sharedInstance().start(withConsumerKey: "xxx", consumerSecret: "xxx")
return true
}
func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
if TWTRTwitter.sharedInstance().application(app, open: url, options: options) {return true}
if FBSDKApplicationDelegate.sharedInstance().application(app, open: url, options: options) {return true}
if SCSDKLoginClient.application(app, open: url, options: options) {return true} // not work this func
return true
}
对于 Facebook 或 Twitter,还有一项功能可以让它们在您进入应用程序时发挥作用,但对于 Snapchat,它不存在。
我在 Snapchat 官方文档中找不到任何相关信息。 可能是什么问题?
最佳答案
再看看info.list,这很棘手,当我遇到同样的问题时,请确保你的 SCSDKRedirectUrl 在你的 snapchat 应用程序中相同,原因是我的 SCSDKRedirectUrl 的第一个字符是大写字母,当我将其更改为小信一切都好 即
<key>SCSDKRedirectUrl</key>
<string>yourAppName://auth/snap</string>
<key>LSApplicationQueriesSchemes</key>
<string>yourAppName</string>
<array>
关于ios - SCSDKLoginKit (snapchat) 中的重定向功能不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55379356/