23

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.

AL.
  • 36,815
  • 10
  • 142
  • 281
Kyle Griffith
  • 607
  • 1
  • 6
  • 12
  • Did you delete the old GoogleService-Info.plist? Just want to make sure there aren't two in there, and its getting the wrong one. – Ian Barber Oct 03 '16 at 23:22
  • I replaced the old GoogleService-Info.plist with the updated one. There is only one file in my root. – Kyle Griffith Oct 04 '16 at 17:04

3 Answers3

34

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

nickpharris
  • 385
  • 5
  • 17
Kyle Griffith
  • 607
  • 1
  • 6
  • 12
  • 3
    wow, is there really no way to change the bundle ID in Firebase? – Phil_Ken_Sebben Jan 12 '17 at 21:38
  • 1
    There really isn't Phil. You can add different projects to the same project, which for some reason was not working on this project. However, doing another project later I was able to add multiple apps to the same project, no problem – Kyle Griffith Jan 12 '17 at 22:25
  • 1
    Like @KyleGriffith said in his comment, I was able to fix the issue by creating a new app in the same project. I had to replace the GoogleService file and update the information for the crash reporting (create and download a new crash reporting JSON file and update the build phase to reference the new file and the new GoogleService Id). – Ryan May 03 '17 at 04:17
  • Just opt for the APN method and generate `.p8` file instead. So much easier. – Grant Jul 27 '18 at 09:41
  • 2
    Yeh, this really sucks. Still can't update bundle ID without creating a new app – Zorayr May 07 '20 at 00:47
1

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.

Todd
  • 500
  • 4
  • 10
  • This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post. - [From Review](/review/low-quality-posts/26548478) – 827 Jun 30 '20 at 17:40
  • 3
    @827 I am not critiquing or requesting clarification. I am simply providing an answer as I found that the accepted one not worth it to create a new Firebase project just to change a Bundle ID. Please read carefully. – Todd Jun 30 '20 at 17:44
  • This might work in some cases, but would not be enough in many others, e.g. when using Firebase Auth. It does not answer the question. – Nikolay Suvandzhiev Dec 23 '20 at 19:41
  • @NikolaySuvandzhiev This works in all cases. In fact, I myself used this technique when I was trying to fix some issues I has with OAuth. It does answer the question. – Todd Dec 23 '20 at 20:31
  • 4
    When you perform the steps you suggested, is the new bundle ID set in the Firebase console's project settings? For me it's not. As a result Firebase Auth with "Sign-in with Apple" didn't work. And in any case having to remember to change the GoogleService-Info.plist is not great. The correct way is to create a new app in the same project as mentioned by the other answer. – Nikolay Suvandzhiev Dec 23 '20 at 23:11
  • @NikolaySuvandzhiev In that case you may be doing it incorrectly. Sign In With Apple and Microsoft OAuth were the reasons I needed to change the bundle ID and my solution worked correctly for me. I was able to get the same result multiple times. – Todd Dec 24 '20 at 03:15
0

If you're logged into the Firebase CLI and have the flutterfire cli installed, you can update the BUNDLE ID in the GoogleService-Info.plist file and then use the flutterfire configure command within your project to sync the apps registered to your Firebase project.

If you changed the name correctly, it should say that a project with the new name for iOS isn't registered and will register it for you. In your Firebase console, you'll then be able to see the old app and a newly registered app with the new name. You can delete one there.