Switching Firebases in a Swift project - ios

I accidentally added the wrong Firebase (let's call it OLD) to my Swift project, so today I went through the process of adding the correct one (NEW) instead. I deleted the old plist config file and added the new one, but when I run the app, I get an error:
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Provided bucket: OLD.appspot.com does not match bucket specified in FIRApp configuration: NEW.appspot.com'
In the GoogleService-Info.plist file, the STORAGE_BUCKET field correctly is NEW.appspot.com, and OLD.appspot.com doesn't show up anywhere. So how can I resolve this?

I have had this problem while dealing with two iOS accounts so I would expect the answer to be similar.
The primary reason is that the old user has been cached to your device. This means that each time you login with the newer one is errors due to expecting the old user which is set up on the previous url. Frustratingly deleting the app, cleaning the app, calling pod update, logging in on the new version and calling logout etc don't seem to have any affect on the problem.
This seems to occur when the user has logged and then a new version with a different url is loaded over the top.
The only way I managed to fix this was to reset the app to its previous settings (put back the OLD firebase url and also the OLD.plist google services file). Load up the app and then logout of the app, this should remove the cached user settings. Now when you load up with the new settings it should not log into the previous user (depending on your auto login app settings) and should allow you to successfully log into the new account.
While doing this remember to download the new .plist file and also make sure the correct bundleID and firebase url are entered.
NOTE: If you are experiencing this problem on the simulator I think you can reset the content and settings. This is found in
Simulator -> Reset Contents and Settings...
Hopefully this helps

I was able to fix this via checking my GoogleService-Info.plist.
If you've used the .plist file multiple times, make sure you've added the right one to your project.
You can always go back to your Firebase console.
Click on the settings icon next to Overview.
Click on Project Settings, choose the app you'd like to download the .plist file for.
Doing this will solve any issue...

Related

ios Firebase Dynamic Link not opening installed app

I've looked at other previous questions about this topic, and I haven't found the solution for my problem.
I've followed this Getting started with Firebase Dynamic Links on iOS, however if I click on the universal link for testing, https://appName.page.link, I get the following message:
Invalid Dynamic Link
Requested URL (https://appName.page.link/) must be a parsable and complete DynamicLink.
If you are the developer of this app, ensure that your Dynamic Links domain is correctly configured and that the path component of this URL is valid
The previous message makes me think that the created page created by Firebase is created yet, however when I visit the page:
https://appName.page.link/apple-app-site-association, I get the following data:
{"applinks":{"apps":[],"details":[{"appID":"TeamID.com.example.appName","paths":["NOT /_/*","/*"]}]}}
This means that the page has been successfully created.
I have verified that the TeamID has been set properly set in the Firebase settings, and also that the TeamID is the same from XCode and from the Apple developer account.
The URLSchemes, set in Xcode is com.example.appName and inside the Signing & Capabilities in the Associated Domains has the domain: applinks:appName.page.link
Is there anything that I'm missing to configure?
I ran into this issue as well following the video. If you continue in the video he mentions that there is a bug for iOS where you might need to completely uninstall the app, restart your device, and then reinstall the app.
for reference:
https://youtu.be/KLBjAg6HvG0?t=532
Did you created dynamic link here? Firebase > Dynamic Links > New Dynamic Link. Your link should looks like https://AppName.page.link/shareLink
I think this behavior is expected, clicking on the URL prefix (https://appName.page.link) without any path will not take the user to the app since the configurations (deep linking, campaign tracking, platform behavior, etc) is not set up yet.
But once you create a new link along with the prefix (e.g. https://appName.page.link/createdLink), it should work properly.
The bit that tripped me up was that I added "Associated Domains" to the "Release" tab instead of the "All" tab. So when I was running on my app, I'd also get the Invalid Dynamic Link error.

New to Firebase and swift. Having trouble connecting Firebase to Xcode

So I am new to swift and xcode so please have mercy. So basically I am trying to connect my project in xcode to Firebase. I am using a blank single view application template and have not bothered with adding any buttons or more view controllers. I am just testing it and trying to connect it to Firebase. So the problem I am having is is the app succeeds in compiling, but then as soon as the application opens in the simulator, it gives me a Thread 1: signal SIGABRT error. I don’t know what I am doing wrong. I have followed all of the installation instructions correctly. I went to Firebase and configured the app with the bundle indentifier. I added the Google-Service.plist file into xcode. I succesful installed all of the pods into my project. I go into the app and add
import Firebase
FIRApp.configure()
into the delegate swift file. I save the project and close it. I open the app workspace file (the one it recommends to open) And then without adding anything to the project or adding any user interface options, I immediately run the project, it says build succeed and then instantly crashes and gives me the Thread 1: signal SIGABRT error. Does anybody have any ideas of what this is? I don’t know what I am doing wrong. I can’t move forward with swift and firebase if I can’t even configure it correctly. Can you please figure this out?
Here is the description of the error it gives me:
TestAppWithJack[71791] <Error> [Firebase/Core][I-COR000012] Could not locate configuration file: 'GoogleService-Info.plist'.
2017-01-14 17:06:19.456 TestAppWithJack[71791:2160021] *** Terminating app due to uncaught exception 'com.firebase.core', reason: '[FIRApp configure] could not find a valid GoogleService-Info.plist in your project.
Did you make sure that the google plist is specifically called GoogleServices-Info.plist? If it isn't specifically that name, then it won't work.
Where did you put GoogleServices-Info.plist? If you dragged it to the wrong place, that could be why it was giving this error because it cannot find the file... Drag GoogleServices-Info.plist under your info.plist it should be fine then.

FIRApp configure fails w/ "Configure Durable Deep Link fails"

Just started w/ Firebase and the first call of the first app fails -- yeah!
[FIRApp configure] throws an exception: "Configure Durable Deep Link fails". There's a GoogleService-info.plist but affect no entry for deep links. Tried toggling a few of the IS_* fields but no luck.
Is this something to be setup on the Dashboard? Are the Pod/Frameworks in github somewhere?
there's a duplicate question from #mskobe
by messing around w/ the PodFile I narrowed it down to removing:
pod 'Firebase/Invites'
not sure if it's an order or combination of other pods/operations.
I just encountered this error! It probably has something to do with your GoogleServices-info.plist file missing an important entry (probably API_KEY or CLIENT_ID).
You can most likely fix this by just re-downloading the GoogleServices-info.plist file again. Go to the Firebase console, select your project, click the little gear icon, select "Project settings" then for your iOS app, download the plist file again.
Delete the old one from Xcode, drag the new one in, and you should be good to go.

Can't download GoogleService-Info.plist file

I'm trying to setup Google Analytics for my new iOS app, when following the instructions here.
It instructs me to click the "Get A Configuration File" button, but that button just sends me to another page that has a spinning, nothing ever happens. I already have a property setup in Analytics for web and a view setup for mobile.
Can anyone share the GoogleService-Info.plist file with me so I can attempt to manually fill in the details of the file and add it to my project?
It happened with me also. If you close everything and follow that link it worked for me next time. You can try to do that. Below is the link of sample plist file, of course I replaced tracking id, bundle id and app id to strings from original values. Hope it helps.
Sample Google Plist file
Generally in iOS
1) Create your project in Firebase console https://console.firebase.google.com
Click add project and follow steps.
2) Now open this link to get GoogleService-Info.plist file
https://developers.google.com/mobile/add
-->Click Get Started
-->Select your project
Ex: CloudFirestoreSwift
--> Now select domain Ex: iOS
-->Now add app bundle id then GoogleService-Info.plist file will be generate, download it and complete the steps if required.
NOTE: Please don't change file name. It's must be GoogleService-Info.plist
If you already generated GoogleService-Info.plist file. Now select your project and go project settings.
--> Go General tab, you can find GoogleService-Info.plist file here download it.
Steps for getting configuration if your first time login to google developer account.
1. Open google developer console.
2. Login to developer console.
3. Create project with valid name.
4. Enable google analytics.
5. Then get the configuration file.
The download link is not always immediately visible and you have to scroll up to get it, I happen to press next before downloading and I missed the opportunity to download the file.
I prefer the automatically generated file as I am lazy (aren't we all)
So, follow these steps
Go to https://developers.google.com/analytics/devguides/collection/ios/v3/
Scroll down to Get a configuration file
When prompted for the app name and bundle Id, just use the drop down menu and you'll find your previously created app details there.
Proceed to the next screen Continue to: Choose and Configure Services
Select your service, note that your previously selected ones will have a green arrow (Analytics in the case below)
Select Generate configuration file
You'll be given an opportunity to download the file again.
Voila!
You need to login on https://console.developers.google.com create your first application, then go back to https://developers.google.com/mobile/add the website will now work correctly.
Installing Ignore X-Frame headers plugin on Chrome made this bug vanish
Same here, I got following invalid json file:
)]}'
{"status":401,"message":"Invalid authuser parameter"}
and that is resolved by clearing cookies on google.com on your browser.
Thanks to Sanjana I decided to look at Google's web code and found they have an X-Frame error.
So the url you can visit is https://accounts.google.com/ServiceLogin?service=cloudconsole&osid=1&passiv…collection/ios/v3/app?configured%253Dtrue&hl=en#add-config&cntlbl=Continue

Blank xcode app generating unexpected errors

What I did was:
create new project via master detail template
select 'use core data'
build -> run using ios sim
I got the following error code:
the model used to open the store is incompatible with the one used to create the store
I googled around and read a lot about data migration and what not. I even following the directions and tried to migrate.
The model used to open the store is incompatible with the one used to create the store, apple store release version
But then it gave me another error message:
can't find model for source code
But since the app is not edited whatsoever, and there is only one version, why is there an issue with data migrating anyways? Shouldn't it just run with no error and just do nothing meaningful?
After the error is thrown, push the stop button on Xcode.
Then, go to the simulator (it should now be on the home screen) and delete the app.
You delete apps from the simulator the same way you do on an actual iPhone (hold down on the icon until it shakes and the 'x' appears in the corner).
Then, run the app again.
You probably, at some point, made another project with the same bundle-id. That project probably had a data-model which is different than the blank (or whatever the default data model is) in the template app, which causes your app to crash somewhere in your AppDelegate.m when it tries to load up the store.

Resources