Migration/3.x problem: undeclared identifier FIRUserInfo

195 views
Skip to first unread message

Tim Carr

unread,
May 18, 2016, 9:23:39 PM5/18/16
to Firebase Google Group
Hi 'basers,

Hilariously I guess i'm attempting to migrate to Firebase 3.x on day zero. That is entirely by coincidence, I had today booked to do update work on an app, saw the pods update, and started following the migration guide.

I've hit one snag so far: "Use of undeclared identifier FIRUserInfo".
I've made sure my podfile includes auth -- I see "Using FirebaseAuth (3.0.2)" in pod update, so that's working.
I've made sure i'm importing auth -- I have "@import FirebaseAuth;" in the header.
I can command-click on FIRUserInfo in Xcode (7.3.1) and sure enough, FirebaseAuth.framework/Headers/FIRUserInfo.h opens up and it looks fine. But I still get the error on build.
I tried cleaning the build folder, restarting xcode etc, no change. I tried adding "#import <FirebaseAuth/FIRUserInfo.h>" but that didn't make any difference (note, that line doesn't generate an error)

Here is the code that doesn't compile (FIRUserInfo as undeclared identifier):

                    [[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;



Any suggestions?

thanks.
-tim

Jonny Dimond

unread,
May 19, 2016, 8:19:21 AM5/19/16
to Firebase Google Group
Hi Tim,

FIRUserInfo is not a class itself, but a protocol. You will need to assign it as such:

id<FIRUserInfo> profile = user.providerData.firstObject;

Have a great day,
  Jonny

Alfonso Gomez Jordana Manas

unread,
May 19, 2016, 12:33:14 PM5/19/16
to Firebase Google Group
Hello Tim,

I see that you find a solution for this error already in StackOverflow. Still, let me link to it from here in case anyone finds this same issue in the future: http://stackoverflow.com/questions/37312095/firebase-3-x-issue-firuserinfo-is-an-undeclared-identifier
Reply all
Reply to author
Forward
0 new messages