Google signs an ambiguous link to the memberโ€™s "index",

application:openURL:options: application delegate method. The method should call the handleURL method of the handleURL instance, which will correctly handle the URL that your application receives at the end of the authentication process.

Directly copied from firebase manual documentation, but still has errors.

 func application(application: UIApplication, openURL url: NSURL, options: [String: AnyObject]) -> Bool { return GIDSignIn.sharedInstance().handleURL(url as URL!, sourceApplication: options[UIApplicationOpenURLOptionsSourceApplicationKey] //Error is here //Ambiguous reference to member 'subscript' error is shown. as? String, annotation: options[UIApplicationOpenURLOptionsAnnotationKey]) } 
+5
source share
2 answers

You have a few questions. The delegate method must have the following signature in Swift 3:

 func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any] = [:]) -> Bool 

and the whole method will be:

 func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any] = [:]) -> Bool { return GIDSignIn.sharedInstance().handleURL(url, sourceApplication: options[UIApplicationOpenURLOptionsKey.sourceApplication] as? String, annotation: options[UIApplicationOpenURLOptionsKey.annotation]) } 
+25
source

If you use multiple URL schemes with Google Sign In, use it as follows:

 func application(application: UIApplication, openURL url: NSURL, options: [UIApplicationOpenURLOptionsKey : Any] = [:]) -> Bool { return GIDSignIn.sharedInstance().handle(url as URL!, sourceApplication: options[UIApplicationOpenURLOptionsKey.sourceApplication] as! String!, annotation: options[UIApplicationOpenURLOptionsKey.annotation]) } 
0
source

Source: https://habr.com/ru/post/1257420/


All Articles