Reputation: 1111
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
Upvotes: 6
Views: 2749
Reputation: 367
Sometimes you need to put the pod 'Firebase/Auth' at the top of above other Pods in the pod file, this worked for me when the usual FirebaseAuth was not being imported
Upvotes: 0
Reputation: 81
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.
Upvotes: 8
Reputation: 1058
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.
Upvotes: 1