I've followed specific steps from the official docs and have implemented SCSDK to login with Snapchat. I added this code to my SceneDelegate to redirect back to my app, but it doesn't work -- the print(url) works and prints the url, but SCSDKLoginClient.application(UIApplication.shared, open: url, options: options) doesn't work at all i even added a debug pointer to check, but nothing .

Is there any solution for this or something i'm missing , and do i have to use SceneDelegate?

Also, I have checked all the data in the info.plist, including the scheme, and everything is in place.

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

and this is the login function in my ViewController:

SCSDKLoginClient.login(from: self) { (success, error) in
    if success == true {
        print("OK")
    } else {
        print("NO")
    }
}
1

There are 1 best solutions below

0
On

Turns Out I was using a wrong account to login in snapchat , I forgot I had to use the same developer account or at least add the other account to this one