Basic remote configuration setup using Firebase Remote Config
Setting up Remote Configuration in your project using Firebase is fairly straightforward and easy. The web portal does a great job guiding you through the initial steps.
- Go to firebase.google.com
- Tap Get Started For Free and follow the prompts to create a new project
- Tap Create New Project
- Enter your project name & tap Create Project
- Once the project is created, you'll land on the Project Overview page
- Tap Add Firebase To Your iOS App
- Enter your app's bundle id & tap Add App
- The GoogleService-Info.plist file should now be in your downloads folder. Copy it into your Xcode project.
- Add the Firebase Core and Remote Config frameworks into your project
-
If you're using CocoaPods, add the following lines to your podfile and install
pod 'Firebase/Core'
pod 'Firebase/RemoteConfig'
-
If you're not using CocoaPods, you'll need to install it manually
- Dowload the Firebase frameworks from the Setup page in Firebase Docs; Look for the Integrate without CocoaPods section
- Add all framework files from the Analytics directory to your project
- Add the FirebaseRemoteConfig framework to your project
- Add Firebase.h to your project
- Import Firebase.h in the bridging header
- Add module.modulemap to your project
- Add the -ObjC flag to Build Settings > Linking > Other Linker Flags
- Configure the Firebase SDK and Remote Config singleton in your app
- In the AppDelegate class, add the following to application(didFinishLaunchingWithOptions:) FIRApp.configure()
- Build to ensure that everything is in place
- Create a new Property List file named "RemoteConfigDefault.plist" (or whatever filename works for you)
- Add a key/value pair for a configurable element in your app (i.e. "label_1"/"This text came from the Firebase Remote Config portal.")
- Implement configuration, fetch and activation in you app
- See init(), fetchRemoteValues() & activateLastFetch() in RemoteConfigManager.swift
- Implement the configurable elements in you app
- See references to RemoteConfigManager in HomeViewController.swift
- Add parameters to the Firebase project console
- Navigate to your project's overview page, then go to Remote Config : Get Started
- Tap Add Your First Parameter
- Enter the same key as the plist file above and a value
- Publish changes