Kodeco Forums

Firebase Tutorial: Getting Started

In this Firebase tutorial, you'll learn Firebase fundamentals including saving data, real-time sync, authentication, user status, and offline support.


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/953-firebase-tutorial-getting-started
1 Like

There is an error trying to build in the model GroceryItem. It says: Type “Any” has no subscript members in the init. I don´t know how to make it work.

init(snapshot: FIRDataSnapshot) {
    let snapshotValue = snapshot.value as! NSDictionary
    key = snapshot.key
    name = snapshotValue["name"] as! String
    addedByUser = snapshotValue["addedByUser"] as! String
    completed = snapshotValue["completed"] as! Bool
    ref = snapshot.ref
}

func toAnyObject() -> Any {
    return [
        "name": name,
        "addedByUser": addedByUser,
        "completed": completed
    ]
}

There was an error when i install Firebase。Why?:confounded:

Installing Firebase (3.5.2)

[!] Error installing Firebase
[!] /usr/bin/curl -f -L -o /var/folders/3n/0y5gxtl92l76mj_xc61xzyww0000gn/T/d20160920-20077-zf61bw/file.tgz https://www.gstatic.com/cpdc/cc5f7aac07ccdd0a/Firebase-3.5.0.tar.gz --create-dirs --netrc-optional

% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:–:-- 0:00:21 --:–:-- 0curl: (7) Failed to connect to www.gstatic.com port 443: Host is down`

Will there be a tutorial released on implementing Dynamic link with FireBase in iOS ?

Lots of compile errors and warnings which is annoying. Hope this gets fixed soon.

Great tutorial ! Thank you :grinning:

ERROR

Apple Mach-O Linker Error Group
clang: error: linker command failed with exit code 1 (use -v to see invocation)

within the grocery item struct, I get the following error:

Type ‘Any’ has no subscript members.

on these 3 lines

name = snapshot.value![“name”] as! String
addedByUser = snapshot.value![“addedByUser”] as! String
completed = snapshot.value![“completed”] as! Bool

func toAnyObject() → AnyObject {

return ["name": name, "addedByUser": addedByUser, "completed": completed] **as AnyObject**

}

Hi there, I have used your tutorial and its great. Is there anyway to use Firebase for OS X applications? Or is Firebase specifically designed for Apps and Web Applications alone? Thanks…

So, I built a shopping list manager app a long time ago and it’s under supported and still in the store. MyShopper. This is feature I’ve long wanted to add.

Also, I’ve been a RayWenderlich customer for a while having used many of the tutorials and purchased some of the books. I have to say, this tutorial is quite ready for prime time. There are a number of things that require tinkering with right out of the box just to get it to build. Sure would like to see a touch more attention to the quality here.

Thanks and please take this as constructive feedback. You’re doing great work.

Great tutorial!

Something I noticed though.
When exiting the app, the user is removed from the online users, which is normal.
When putting the app in the background, the user stays in the online users, which I guess might be normal as well.
When locking the phone, the user is removed from the online users. Let’s pretend it’s normal.

The problem comes when going back to the app. The user isn’t online anymore but he/she should be.

Any idea what’s the reason? Bug within the Firebase library?

Any chance you could over creating a user with a unique username like Twitter and Instagram? Currently can only authenticate with password and email.

Lots of people seem to be asking for it in relation to Firebase but there doesn’t seem to be an accepted answer out there at the moment. Would be amazing if RW could come to the rescue :slight_smile:

Did you try to launch your project from [project_name].xcworkspace file?

Just downloaded the start project and getting a lot of Swift Compiler Errors.

This is on Xcode 8 that was just released. Is anyone else getting this issue?

I got the same issue.

Thanks for the feedback! The sample projects have been updated!

Thank you all for your feedback! The sample projects have been updated, no more compiler issues!

Thanks @cynicalme! Also, for anyone not being able to download the plist file and getting a forbidden file when attempting to download: try to sign out of all your google accounts and make sure you’re only signed into the one. I was logged into 2 other accounts and only after signing out was I able to download the file. Perhaps @cynicalme can make a note of that in the tutorial.