【问题标题】:Firebase RemoteConfigSettings doesn't reflect minimumFetchInterval changesFirebase RemoteConfigSettings 不反映 minimumFetchInterval 更改
【发布时间】:2019-07-29 00:29:09
【问题描述】:

我正在尝试将minimumFetchInterval 更改为我的RemoteConfigSettings。我将值设置为 0,但值不会更新。作为一种解决方法,我可以创建一个新的 RemoteConfigSettings 对象,在那里设置值,然后将设置分配给 remoteConfig 实例。

let remoteConfig = RemoteConfig.remoteConfig()
remoteConfig.configSettings.minimumFetchInterval = 0

回读 minimumFetchInterval 仍显示默认值 43200。

标头在 Obj-C 中定义为: @property(nonatomic, assign) NSTimeInterval minimumFetchInterval; 所以我希望这个值能够反映分配。

这确实有效:

remoteConfig = RemoteConfig.remoteConfig()

let configSettings = RemoteConfigSettings()
configSettings.minimumFetchInterval = 0
remoteConfig.configSettings = configSettings

我能够解决这个问题,但这应该得到解决。我是否遗漏了什么,还是我应该继续认为这些 API 不正确?

RemoteConfigSettings 类的文档甚至没有提到 minimumFetchInterval 属性,而是他们的文档如何。

【问题讨论】:

    标签: swift firebase firebase-remote-config


    【解决方案1】:

    link 中所述,Firebase 远程配置最小获取间隔取决于 3 个参数:

    1. 在 fetch(long seconds) 调用中传递的参数。

    2. FirebaseRemoteConfigSettings.setMinimumFetchIntervalInSeconds(long seconds)中的参数

    3. 默认值为 43200 秒,即 12 小时。

    当使用FirebaseRemoteConfigSettings.setMinimumFetchIntervalInSeconds(long seconds)

    您需要使用“Builder”模式并在 FirebaseRemoteConfigSettings 中将其设置为

    对 FirebaseRemoteConfigSettings 的 get() 操作不会返回 SDK 正在使用的原始对象

    此外,您可以在 Firebase 团队 here 提供的示例项目中看到相同的内容。即

    let settings = RemoteConfigSettings()
    settings.minimumFetchInterval = 0
    remoteConfig.configSettings = settings
    

    【讨论】:

    • 感谢您指出他们的示例使用。它确实说“启用开发人员模式”,这是该示例未使用的已弃用功能,因此我仍然不信任他们的代码。无论哪种方式,如果这是真的,那么他们应该让构造函数接受参数而不是分配它。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-09-14
    • 1970-01-01
    • 1970-01-01
    • 2014-11-26
    相关资源
    最近更新 更多