Firebase Tutorial: Getting Started

I have the most recent xcode 8.1 beta and the app builds and runs perfect. The only issue is, when I go in and create an account, the app crashes and gives a ā€˜EXC_BAD_INSTRUCTIONā€™ for step // 2 of the FIRAuth.auth under saveAction. Any way around this?

Hello Sir,
iā€™ve a question about child node in firebase.
Database Structure
(1) users (root)
(1.1) childByAutoId
(1.1.1) username
(1.1.2) email

Question
how to check that username = foo is available or not?

Hi Cleota! The Firebase SDK support OS X as well!

Firebase supports Facebook, Twitter, GitHub and Google OAuth out of the box. If itā€™s fancy you can implement your own authentication logic as well. See: Firebase Documentation

Hello simonqq! I also use multiple Google accounts, had no problem downloading the plist file. I only have to make sure Iā€™m using the correct one.

Hello vatsal19925h,

You can call - fetchProvidersForEmail:completion: to fetch the list of IdPs that can be used for signing in with the provided email address. See the docs for more info:

Never mind, I was able to fix the issue. I had to add FIRApp.configure() to the AppDelegate.swift func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) ā†’ Bool

Love the tutorial and thanks for your hard work.

Where can one find the older version of this tutorial (Firebase 2.5.1) written by David East? Iā€™m still using an older version of Firebase in one of my applications and wanted to look at the presence management system functionality. Newer documentation would mean I would have to update my code and I havenā€™t reached that point in my project where I want to/need to.

Great tutorial! I had a question about the database permissions. After implementing the authentication part, I went back to Firebase console and changed the read/write permissions back to the default (ā€œuser != nullā€). That silenced the warning about the database being public and made me feel betterā€¦ and, the app still worked! :slight_smile: I am curious though: as there is an API key in the GoogleService-Info.plist, could anyone really write to my database without that key (when the permissions were wide-open)? Thanks.

After I register a user on signUpDidTouch, it does not seem to log me into the tableview screen? It just stays in the login page.

How come it passes in the textFieldLoginEmail and textFieldLoginPassword fields if those are initially empty? Should it not pass in the alert textfields text?

Completely agree! You should use the data from the alert view, not from the text fields.

Hello,

I built and run your app. It works fine :slight_smile:
I tried to upload it to a real iPhone using my provisioning profile and your app bundle ID. The build went smoothly but when I tried to run it on the real device there was an error saying that

App installation failed
The application could not be verified.

I read many opinions on StackOverflow etc and everybody said - just delete the app and try again but it was never installed so I could not delete it.

I also tried changing to my new bundle ID with a new plist generated by Firebase but still no success.

After that I tried rebuilding CocoaPods from scratch but still I get the same error.

I understand it has something to do with the signing of the app before running it on the real iphone but I cannot solve the problem.

Any help?

Thanks

I was unable to use the Podfile you supplied. Had to morph it to this and then all worked okay after ā€˜pod repo updateā€™ and ā€˜pod installā€™:

Podfile:

source ā€˜GitHub - CocoaPods/Specs: The CocoaPods Master Repoā€™
inhibit_all_warnings!
workspace ā€˜Grocrā€™
xcodeproj ā€˜Grocr.xcodeprojā€™
use_frameworks!
platform :ios, ā€˜10.0ā€™
target ā€˜Grocrā€™ do
pod ā€˜Firebase/Coreā€™
pod ā€˜Firebase/Databaseā€™
pod ā€˜Firebase/Authā€™
end

Solved this one. The warning you get on the AppDelegate in 8.0, Swift 3.0 will make the call to configure inaccessible if you follow the fix-it (which makes the method private):

Showing All Messages
./Grocr-starter/Grocr/AppDelegate.swift:30:8: Instance method ā€˜application(:didFinishLaunchingWithOptions:)ā€™ nearly matches optional requirement 'application(:didFinishLaunchingWithOptions:)ā€™ of protocol ā€˜UIApplicationDelegateā€™

Donā€™t do that!

This was very helpful and had almost no issues I could not figure out. Very good job and highly informative. Thanks very much!

how to solve that.?i got the same issue which i cant create user .

but i still cant create user ā€¦i means the user did not created in firebase

First Iā€™d like to say that this is a fantastic tutorial. Iā€™ve learned a lot so far.

But, I can create a user as I see it in the database, But when I try and log in with that user, I get the following error.

2016-10-18 19:32:30.080: <FIRInstanceID/WARNING> Failed to retrieve the default GCM token after 5 retries

Not sure where to look.

Thanks

Ron Cookson

In case that you get a ā€œThe dependency Firebase/Core is not used in any concrete target.ā€ error when doing a pod update, change the Podfile to the following:

target 'Grocr' do
	pod 'Firebase/Core'
	pod 'Firebase/Database'
	pod 'Firebase/Auth'
end

Excellent tuto! One of the most useful Iā€™ve done for a long time.

Idea for a part two (I might try to implement it on my ownā€¦) : I like to categorize my grocery list by type of ingredients : fruits and veggies, dairy, cereals. How would one add these categories to the Grocr app and furthermore, what would the database structure look like? The reflex of handling this with table-like data structure is hard to pass byā€¦