swiftios13snapchatsnapkitxcode11.3

snapkit login kit not working Swift Xcode 11.3.1


I am using Xcode 11.3.1 and try to login with snapchat with loginkit I add the add information in info.plist and my code is

  SCSDKLoginClient.login(from: self, completion: { success, error in

                        if let error = error {
                            print(error.localizedDescription)
                            return
                        }

                        if success {
                            self.fetchSnapUserInfo() //example code
                        }
                    })

this code show me the login ui of snapchat and I am login into snapchat with my account. but I am stuck on this ui enter image description here

when I am click on continue nothing is happing . SCSDKLoginClient completion block not called.


Solution

  • hello everyOne soo finally i found the solution

    i am using 11.3.1 and when i create new project the add AppDelegate and SceneDelegate default class.

    so according to snapchat logkit documentation i add

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

    method in my Appdelegate class. but this method never get called in xocode 11.3.1 so the solution of my problem is this

     func scene(_ scene: UIScene, openURLContexts URLContexts: Set<UIOpenURLContext>) {
       guard let url = URLContexts.first?.url else {
           return
       }
    
         SCSDKLoginClient.application( UIApplication.shared, open: url, options: nil)
        }
    

    you need to add this method into your sceneDelegate file. then everything work fine. synpchat need to update there doc for new xcode 11.3.1. i hope this answer help you guy's because i also wast my 3 day's on this issue. happy Coding :)