0

I have been trying to use LoginKit from Snapchat to connect a user's bitmoji and Snap info, however after allowing access on Snapchat, it just stays on a yellow screen, not redirecting to my app. I have verified that the info.plist is properly set up and that the Redirect URL is the same as in the SnapKit Dev portal. I believe it may have something to do with this bit of code in the AppDelegate, which is based off of what Snapchat suggests in their development guide:

    func application(_ app: UIApplication,
                     open url: URL,
                     options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
        return SCSDKLoginClient.application(app, open: url, options: options)
    }

I believe it may have something to do with iOS 13 as this link suggests. However, I was unable to properly adjust with the SCSDKLoginClient information. Please let me know what can be done to fix this. Thanks in advance.

Yuchi
  • 37
  • 4
  • Are you using a SceneDelegate for iOS 13? On iOS 13 when having an enabled method, the SceneDelegate counterpart will be called instead of the AppDelegate method. This could maybe explain your situation. – lennartk Jun 08 '20 at 12:56
  • Hi, thanks for your response. Being that the SceneDelegate uses "func scene(_ scene: UIScene, openURLContexts URLContexts: Set) { ... }", how would I go about using "SCSDKLoginClient.application(app, open: url, options: options) }"? – Yuchi Jun 08 '20 at 15:08

1 Answers1

2

You should use the SceneDelegate on iOS 13. You need to properly format the URLContext first to properly call the SnapKit client:

func scene(_ scene: UIScene, openURLContexts URLContexts: Set<UIOpenURLContext>) {
    for urlContext in URLContexts {
        let options: [UIApplication.OpenURLOptionsKey : Any] = [
            .openInPlace: urlContext.options.openInPlace,
            .sourceApplication: urlContext.options.sourceApplication,
            .annotation: urlContext.options.annotation
        ]
        SCSDKLoginClient.application(UIApplication.shared, open: urlContext.url, options: options)
    }
}
lennartk
  • 570
  • 1
  • 4
  • 15