Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Changing bundle ID for Firebase

Early on in this project I made the error of not having the prefix com in the bundle identifier. Now I am ready to test flight and I have an invalid bundle identifier.

Currently, my bundle identifier is mycompany.myProject but I want it to be com.mycompany.myproject. I have no problem switching to the desired bundle id for archiving the app and uploading to the app store.

The steps I took to switch the app to the appropriate bundle identifier:

  1. Create new app in firebase console with correct bundle ID.
  2. Download Google-Info.plist of this new app and place in projects root and drag into Xcode project.
  3. Change bundle identifier on Facebook
  4. Change bundle identifier in project settings

However, the app crashes fatally with this error.

*** Terminating app due to uncaught exception 'InvalidPathValidation', reason: '(child:) Must be a non-empty string and not contain '.' '#' '$' '[' or ']''

The point at which this error arises is when a Firebase method is called

- (NSString *) getUid {
return [FIRAuth auth].currentUser.uid;
}

This method returns nil which feeds a method for retrieving data from Firebase. This method's nil return causes the InvalidPathValidation error.

I am authenticating with Facebook. I thought maybe the reason this is returning nil is that the app doesn't know who is logged in, because I was never prompted to login (my app checks if your logged in through Facebook in viewWillAppear on the opening ViewController). However this doesn't make sense because the only change I made was changing the bundle ID. I have been stuck on this problem for almost a week.

I am specifically wondering what do I need to change for Firebase to accept the bundle identifier changes.

like image 358
Kyle Griffith Avatar asked Oct 03 '16 22:10

Kyle Griffith


2 Answers

The solution was to create a new app within the same firebase project

like image 173
Kyle Griffith Avatar answered Oct 05 '22 16:10

Kyle Griffith


The above answer may have been correct at the time of publication but what helped me was changing the bundle identifier in the Signing and Capabilities settings of the Target. Then, I went to the GoogleService-Info.plist file and I changed the value for BUNDLE_ID. Then, I hit Command +B to build the app and I ran the app. It worked just fine for me and I didn't get any errors.

like image 42
Todd Avatar answered Oct 05 '22 15:10

Todd