Я пытаюсь интегрировать gmailsignup, чтобы получить сведения о пользователе. Но, к сожалению, происходит сбой приложения, и в консоли я получаю «причину»: в вашем приложении отсутствует поддержка следующих схем URL: com.googleusercontent.apps.184175093548-lsh99pp3c7hcglf12e2udcm0vcinjvd9 '"Если кто-нибудь поможет мне исправить это было бы здорово. Заранее спасибо.
//AppDelegate class, which I have written additionally.
import UIKit
import GoogleSignIn
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate, GIDSignInDelegate {
var window: UIWindow?
func sign(_ signIn: GIDSignIn!, didSignInFor user: GIDGoogleUser!, withError error: Error!) {
if let error = error {
print("\(error.localizedDescription)")
} else {
// Perform any operations on signed in user here.
let userId = user.userID // For client-side use only!
let idToken = user.authentication.idToken // Safe to send to the server
let fullName = user.profile.name
let givenName = user.profile.givenName
let familyName = user.profile.familyName
let email = user.profile.email
// ...
}
}
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: \[UIApplication.LaunchOptionsKey: Any\]?) -> Bool {
GIDSignIn.sharedInstance().clientID = "184175093548-lsh99pp3c7hcglf12e2udcm0vcinjvd9.apps.googleusercontent.com"
GIDSignIn.sharedInstance().delegate = self
let navigation = UINavigationController()
let mainView = gmail(nibName: "gmail", bundle: nil) //ViewController = Name of your controller
navigation.viewControllers = \[mainView\]
self.window!.rootViewController = navigation
self.window?.makeKeyAndVisible()
// Override point for customization after application launch.
return true
}
func application(_ app: UIApplication, open url: URL, options: \[UIApplication.OpenURLOptionsKey : Any\] = \[:\]) -> Bool {
return GIDSignIn.sharedInstance().handle(url as URL?,
sourceApplication: options\[UIApplication.OpenURLOptionsKey.sourceApplication\] as? String,
annotation: options\[UIApplication.OpenURLOptionsKey.annotation\])
}
//View controller class
import UIKit
import GoogleSignIn
class gmail: UIViewController,GIDSignInUIDelegate {
override func viewDidLoad() {
super.viewDidLoad()
var error: Error?
let signinbtn = GIDSignInButton(frame: CGRect(x: 100, y: 100, width: 100, height: 50))
// Do any additional setup after loading the view.
GIDSignIn.sharedInstance().uiDelegate=self
signinbtn.center = view.center
view.addSubview(signinbtn)
}
func signInWillDispatch(signIn: GIDSignIn!, error: NSError!) {
// myActivityIndicator.stopAnimating()
}
}