iOS / OS X Quickstart Guide

First, you'll need to sign up to get your own Firebase.

Downloading

You can grab the latest Firebase.framework by right clicking below and choosing "Save As...":

Download Firebase SDK for Objective-C

You can also install the Firebase Xcode project templates to get a fully-configured Firebase project right from Xcode's "New Project" wizard:

Xcode Project Templates

Alternatively, if you're using CocoaPods, add the following to your Podfile and skip to the "Getting started" section.

pod 'Firebase', '~> 1.0.0'

Installing

  1. Unzip the above file and drag the .framework folder to your XCode project under Frameworks.

  2. Firebase depends on these other frameworks. Add them to your project:

    • libicucore.dylib
    • libc++.dylib
    • CFNetwork.framework
    • Security.framework
    • SystemConfiguration.framework
  3. Firebase makes use of Objective-C classes and categories, so you'll need to add this under "other linker flags" in build settings:
    • -ObjC

Getting started

Simply include the Firebase header in your app to get all the needed classes:

#import <Firebase/Firebase.h>

Using the Firebase API to synchronize your data is easy:

// Create a reference to a Firebase location
Firebase* f = [[Firebase alloc] initWithUrl:@"https://myapp.firebaseIO-demo.com/"];

// Write data to Firebase
[f setValue:@"Do you have data? You'll love Firebase."];

// Read data and react to changes
[f observeEventType:FEventTypeValue withBlock:^(FDataSnapshot *snapshot) {
  NSLog(@"%@ -> %@", snapshot.name, snapshot.value);
}];

Notes

  1. By default, all realtime data blocks run on the main thread. This can be globally changed by invoking the static [Firebase setDispatchQueue:] to specify a queue of your choice. Or, alternatively, for individual blocks by wrapping code with a dispatch to a specific queue such as the one returned by dispatch_get_global_queue().

  2. Firebase objects and observing locations are very lightweight. You can use and discard them as needed.

  3. The Firebase.framework is already being used by apps currently in the Apple App Store; it has passed the review process without issue.

For RubyMotion Users

To use Firebase with RubyMotion:

  1. Download the framework as above and extract it to the vendor folder in your project

  2. Add the dependencies to your Rakefile:

     app.libs += ['/usr/lib/libicucore.dylib', 'libc++.dylib']
     app.frameworks += ['CFNetwork', 'Security', 'SystemConfiguration']
  3. Add the vendor project to your Rakefile:

     app.vendor_project('vendor/Firebase.framework', :static, :products => ['Firebase'] ,:headers_dir => 'Headers')

Next Steps

If you haven't already done so, you should try our tutorial. Next, we recommend checking out our example apps or reading on in the docs:


Have a suggestion to improve the documentation on this page? Tell us!