问题
I've got an existing iOS app that's been using the SnapKit (LoginKit) SDK for a year or so without any problems.
All of the Info.plist items like SCSDKClientId
, SCSDKRedirectUrl
(which for example is myawesomeapp://snap-oauth
), etc are set. As I said, the app has been working properly for a while now.
I just updated the SnapSDK from 1.3.2 to 1.6.5 (to try to fix a bitmoji crash), and now the login fails.
In particular, in the Login ViewController, when the user taps the Snapchat button, the following runs:
// Login ViewController
@IBAction func snapchatButtonTapped(_ sender: Any) {
SCSDKLoginClient.login(from: self.presenter.externalLoginViewController) {
// callback code...
}
}
which kicks off the snapchat login process. The Snapchat UI fires up and the user authenticates. When the user is sent back to my app, the code in AppDelegate
is called:
// AppDelegate
func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey: Any] = [:]) -> Bool {
if let host = url.host, host == "snap-oauth", url.scheme == "myawesomeapp" {
let response = SCSDKLoginClient.application(app, open: url, options: options)
return response
} else if ...
I can walk through the this section in the debugger to see that indeed it is being called. The URL (for example) is:
myawesomeapp://snap-oauth?code=M1MC29J...&state=zQolSLOgYZ8Ht...
The url.scheme
, and url.host
are correct, so we then go to the statement:
let response = SCSDKLoginClient.application(app, open: url, options: options)
This call is now returning false (using SnapKit 1.6.5) where previously (using SnapKit 1.3.2), it would return true. Hence the login has failed.
Nothing else has changed, so I'm not sure why it's failing.
I can backrev SnapKit to version 1.3.2 and the app is able to login again.
I've also looked at the SnapKit console to see if there was anything that needed to change on the console to allow the upgrade, but didn't find anything.
Any ideas?
Thanks!
Edit: After further investigation, it looks like it works on a real device, but not on a simulator.
Edit 2: Looks like the last version that works on the sim is 1.6.2. 1.6.3 and later is where the sim stops working.
来源:https://stackoverflow.com/questions/64357490/snapkit-login-fails-after-upgrading-from-1-3-2-to-1-6-5-scsdkloginclient-applic