Reputation: 6804
No matter what I try, FIRUserInfo is an undeclared identifier. I'm trying to migrate from Firebase 2.x to 3.x: somehow the recent changes on google/firebase server side broke my app's facebook auth integration.
I made sure my Podfile installs FirebaseAuth 3.0.2. I made sure my header does import @FirebaseAuth. I tried cleaning my build folder, restarting xcode etc.
In Xcode 7.3.1 I can command-click FIRUserInfo and it does indeed find the header file in the pod framework as expected. But it won't compile - the last line below fails with FIRUserInfo as undeclared identifier.
@import Firebase;
...
[[FIRAuth auth] signInWithCredential:credential completion:^(FIRUser * _Nullable user, NSError * _Nullable error) {
if (error || user.providerData.count < 1) {
DDLogWarn(@"Firebase login after facebook failed: %@", error);
if( weakSelf.signInCompletionHandler ) {
weakSelf.signInCompletionHandler(false, false, nil);
weakSelf.signInCompletionHandler = nil;
}
} else {
FIRDatabaseReference *userRef = [[FIRDatabase database] reference];
userRef = [userRef child:[NSString stringWithFormat:@"users/%@", user.uid]];
FIRUserInfo *profile = user.providerData.firstObject;
Upvotes: 1
Views: 2882
Reputation: 1699
I have the same problem of undeclared type with FIRDatabaseReference, and cannot fix it by updating the pod-file.
Finally, I find out a solution.
Google teach us to import only
import Firebase
Just add:
import FirebaseDatabase
and everything will become fine
Upvotes: 0
Reputation: 1
i am new in ios and have same problem use
#import <FirebaseAuth/FirebaseAuth.h>
instead of
@import Firebase;
may it help..
Upvotes: 0
Reputation: 6804
Found the answer. Change this: FIRUserInfo *profile
... to this:
id<FIRUserInfo> profile
Man I must have been REALLY tired to miss that. Sorry for yelling, internets...
Upvotes: 5
Reputation: 19960
Try using
pod 'Firebase/Auth'
In your Podfile an
@import Firebase;
Rather than the specific module - this should import the correct modules automatically.
Upvotes: 2