use firebase remote config
2018-03-03 07:20
302 查看
Use Firebase Remote Config on iOS
You can use Firebase Remote Config to define parameters in your app and update their values in the cloud, allowing you to modify the appearance and behavior of your app without distributing an app update.Add Remote Config to your app
Install the Firebase SDK.Add the following dependency to your Podfile:pod 'Firebase/RemoteConfig'
Run
pod installand open the created
.xcworkspacefile.
Import the Firebase module in your
UIApplicationDelegate:
SWIFT
OBJECTIVE-C
@import Firebase;Configure a
FirebaseAppshared instance, typically in your application's
application:didFinishLaunchingWithOptions:method:
SWIFT
OBJECTIVE-C
// Use Firebase library to configure APIs[FIRApp configure];
Create the singleton Remote Config object, as shown in the following example:
SWIFT
OBJECTIVE-C
self.remoteConfig = [FIRRemoteConfig remoteConfig];This object is used to store in-app default parameter values, fetch updated parameter values from the service, and control when fetched values are made available to your app. To learn more, see Remote Config API Overview.Set in-app default parameter values
You can set in-app default parameter values in the Remote Config object, so that your app behaves as intended before it connects to the Remote Config Server, and so that default values are available if none are set in the service.Define a set of parameter names, and default parameter values using an NSDictionary object or a plist file.Add these values to the Remote Config object using setDefaults:.
Get parameter values to use in your app
Now you can get parameter values from the Remote Config object. If you later set values in the Remote Config service, fetch them, and then activate them, those values are available to your app. Otherwise, you get the in-app parameter values configured using setDefaults:. To get these values, call the configValueForKey: method, providing the parameter key as an argument.Connect your app in the Firebase console
In the Firebase console, add your app to your Firebase project.Set parameter values in the service (as needed)
In the Firebase console, open your project.Select Remote Config from the menu to view the Remote Config dashboard.
Define parameters with the same names as the parameters that you defined in your app. For each parameter, you can set a default value (which will eventually override the in-app default value) and you can also set conditional values. To learn more, see Remote Config Parameters and Conditions.
Fetch and activate values from the service (as needed)
To fetch parameter values from the Remote Config Server, call the fetchWithCompletionHandler:or fetchWithExpirationDuration:completionHandler: method. Any values that you set on the Remote Config Server are fetched and cached in the Remote Config object.To make fetched parameter values available to your app, call the activateFetched method.
Because these updated parameter values affect the behavior and appearance of your app, you should activate the fetched values at a time that ensures a smooth experience for your user, such as the next time that the user opens your app.
相关文章推荐
- do A/B test with firebase remote config
- firebase messaging - Register for remote notification
- HOWTO: Use Interface-based remote objects with config files
- Didn't find class "com.google.firebase.provider.FirebaseInitProvider"
- [AngularFire] Angular File Uploads to Firebase Storage with Angular control value accessor
- 如何将结合了 Firebase 的 AdMob 添加到新建的 Cocos2d-x 项目
- web.config中的pageBaseType问题
- Android 集成FireBase CloudMessage&Notification
- android云后端之FireBase配置
- <context:component-scan base-package="com.a" /> 与<context:annotation-config />
- 当使用Firebase时出现警告 How to remove the Xcode warning Apple Mach-O Linker Warning 'Pointer not aligned at address
- github+firebase建站
- grid combo blur not fire when use tab key.
- node.js开发框架clouda、meteor、derby、firebase对比笔记
- understanding firebase database billing
- [Hive - LanguageManual] Select base use
- javascript:base.superclass.constructor.call(this,config)
- how to fix "Cannot find a valid baseurl for repo: poptop-stable/7" in centos 7 *64 when use "yum -y
- AdMob中Firebase Analytics功能,你开始用了么?