At Google I/O 2016, we announced Firebase - a new toolkit for building mobile apps. Firebase replaces several existing Google developer technologies, and adds many new services. This guide walks you through the process of updating your apps from projects created using the existing setup tool or Google API console.
You can learn more about Firebase in our documentation. If you're upgrading from an existing Firebase.com project, please see our upgrade guide. If you have trouble migrating, reach out to our developer support.
Migrate your console project
Firebase manages all of your API settings and credentials through a single configuration file. The file is namedgoogle-services.json on Android and
GoogleService-Info.plist on iOS. It can be downloaded by following
the steps below.
Go to Firebase console and select Import Google Project.- Select an existing project.
- If using App Invites, select the Dynamic Links panel and accept the warning. This enables Firebase Invites.
- Configure your project in Firebase:
- Click the cog in the left hand menu, and select Project Settings.
- For each of your iOS apps, select them and add your app store ID and team ID.
- For each app in your project, download updated
google-service.jsonorGoogleService-Info.plistfiles from the Firebase console. This will contain required information for Google Analytics, Cloud Messaging, and Google Sign In.
Update your Cocoapods configuration
Most services have moved to the Firebase pod from the Google pod, but
Google/SignIn and Google/Analytics are unchanged. You'll need to update your
Podfile as below.
| Old Dependency | New Dependency |
|---|---|
| Google/Core | pod 'Firebase/Core' |
| Google/SignIn | Google/SignIn |
| Google/Analytics | Google/Analytics |
| Google/CloudMessaging | pod 'Firebase/Messaging' |
| Google/AppInvite | pod 'Firebase/Invites' |
| Google/AdMob | pod 'Firebase/AdMob' |
Configuring the Firebase SDK
You'll need to update the configuration code used in your AppDelegate from the
Google pod version to the Firebase pod version. This will configure both the
Firebase and Google pod libraries.
| BEFORE |
|
| AFTER |
|
Upgrade Google App Invites to Firebase Invites
Update your Podfile.
| BEFORE |
pod 'Google/AppInvite' |
| AFTER |
pod 'Firebase/Invites' |
Update the Invites receiving code
In your AppDelegate in the application:didFinishLaunchingWithOptions method:
| BEFORE |
SwiftGINInvite.applicationDidFinishLaunching() Objective-C[GINInvite applicationDidFinishLaunching]; |
| AFTER |
SwiftFIRInvites.applicationDidFinishLaunchingWithOptions(launchOptions) Objective-C[FIRInvites applicationDidFinishLaunchingWithOptions:launchOptions]; |
Still in the AppDelegate in the
application:openURL:sourceApplication:annotation: method
| BEFORE |
Swift
let invite = GINInvite.handleURL(url, sourceApplication:sourceApplication, annotation:annotation)
if (invite != nil) {
GINInvite.completeInvitation()
let matchType =
(invite.matchType == GINReceivedInviteMatchType.Weak) ? "Weak" : "Strong"
// ... process invite.
Objective-C
GINReceivedInvite *invite = [GINInvite handleURL:url
sourceApplication:sourceApplication
annotation:annotation];
if (invite) {
[GINInvite completeInvitation];
NSString *matchType =
(invite.matchType == kGINReceivedInviteMatchTypeWeak) ? @"Weak" : @"Strong";
// ... process invite
|
| AFTER |
Swift
if let invite = FIRInvites.handleURL(url, sourceApplication:sourceApplication, annotation:annotation) as? FIRReceivedInvite {
let matchType =
(invite.matchType == FIRReceivedInviteMatchType.Weak) ? "Weak" : "Strong"
// ... process invite
Objective-C
FIRReceivedInvite *invite =
[FIRInvites handleURL:url sourceApplication:sourceApplication annotation:annotation];
if (invite) {
NSString *matchType =
(invite.matchType == FIRReceivedInviteMatchTypeWeak) ? @"Weak" : @"Strong";
// ... process invite.
}
|
Update the Invites sending code
Update the protocol your UIViewController implements
| BEFORE |
GINInviteDelegate |
| AFTER |
FIRInviteDelegate |
The actual callback method is unchanged.
Send the invite
| BEFORE |
SwiftGINInvite.inviteDialog() Objective-C[GINInvite inviteDialog]; |
| AFTER |
SwiftFIRInvites.inviteDialog() Objective-C[FIRInvites inviteDialog]; |
Upgrade AdMob by Google
Update your CocoaPods dependencies.
| BEFORE |
pod 'Google/AdMob' |
| AFTER |
pod 'Firebase/AdMob' |
No code changes are required.
Upgrade Google Cloud Messaging (GCM) to Firebase Cloud Messaging (FCM)
You can continue to use your existing GCM integration, but if you want to take advantage of the Notifications composer GUI, you will need to update to FCM: see our full guide to upgrading your iOS GCM app to use FCM.

