I am following the instructions of the official Firebase channel (https://firebase.google.com/docs/auth/ios/google-signin?hl=en-419) to subscribe into my app using Google authentication. The problem appears in the function
func sign(_ signIn: GIDSignIn!, didSignInFor user: GIDGoogleUser!, withError error: Error?)
Where it does not resolve the identifiers GoogleAuthProvider and Auth from the commands. i.e. "Use of unresolved identifier 'GoogleAuthProvider'"
let credential = GoogleAuthProvider.credential(idToken: authentication.idToken, accessToken: authentication.accessToken)
// ...
Auth.auth().signIn(with: credential) { (user, error) in
if let error = error {
// ...
return
}
I imported in both the viewer and the AppDelegate:
import Firebase
import GoogleSignIn
And my Podfile looks like that:
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
target 'racc' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for racc
pod 'Firebase/Core'
pod 'GoogleSignIn'
pod 'Firebase/Auth'
target 'raccTests' do
inherit! :search_paths
# Pods for testing
end
end
I am working in Swift 4
Google Firebase is a Google-backed application development software that enables developers to develop iOS, Android and Web apps. Firebase provides tools for tracking analytics, reporting and fixing app crashes, creating marketing and product experiment.
You can sign in users to your Firebase app either by using FirebaseUI as a complete drop-in auth solution or by using the Firebase Authentication SDK to manually integrate one or several sign-in methods into your app. The recommended way to add a complete sign-in system to your app.
FirebaseUI provides a customizable, open source, drop-in auth solution that handles the UI flows for signing in users. The FirebaseUI Auth component implements best practices for authentication on mobile devices and websites, which can maximize sign-in and sign-up conversion for your app.
Prices are per successful verification. On the Blaze plan, Phone Authentication provides a no-cost tier. The first 10K verifications for both instances (USA, Canada, and India and All other countries) are provided at no cost each month. You are only charged on usage past this no-cost allotment.
You need to import FirebaseAuth
into your App Delegate.
In your Podfile:
pod 'Firebase/Auth'
In your AppDelegate:
import FirebaseAuth
These steps are missing from the official Google instructions.
It's most likely that you do not have Google Login enabled in your Firebase Dashboard. To enable, go to the Firebase Dashboard, and click on your project.
From there, tap Authentication, and Sign-In Method. Find Google, and hit Enable.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With