Ios Firebase can';t设置RemoteConfig默认值

Ios Firebase can';t设置RemoteConfig默认值,ios,firebase,firebase-remote-config,Ios,Firebase,Firebase Remote Config,我正在使用Firebase的RemoteConfig框架。 从Firebase服务器获取数据工作正常(已在生产环境中工作),但设置默认值似乎不起作用。我试图坚持文档,但也许我做错了什么 为了测试这一点,我做了以下工作: [self.remoteConfig setDefaults:@{@"key1": @"value1"}]; 然后,在Firebase控制台中,我设置参数key1,使其具有默认的无值,该值向客户端发送零数据。我没有定义任何其他条件,因此这是将发送的唯一值。根据,在这种情况下,R

我正在使用Firebase的
RemoteConfig
框架。 从Firebase服务器获取数据工作正常(已在生产环境中工作),但设置默认值似乎不起作用。我试图坚持文档,但也许我做错了什么

为了测试这一点,我做了以下工作:

[self.remoteConfig setDefaults:@{@"key1": @"value1"}];
然后,在
Firebase控制台
中,我设置参数
key1
,使其具有默认的
无值
,该值向客户端发送零数据。我没有定义任何其他条件,因此这是将发送的唯一值。根据,在这种情况下,
RemoteConfig
对象应该选择默认值

获取代码:

[self.remoteConfig fetchWithExpirationDuration:self.configurationExpirationDuration
                           completionHandler:^(FIRRemoteConfigFetchStatus status,
                                               NSError * _Nullable error) {
  if (status == FIRRemoteConfigFetchStatusSuccess) {
    [self.remoteConfig activateFetched];

    FIRRemoteConfigValue *remoteValue1 = [self.remoteConfig configValueForKey:@"key1"];
    NSString *value1 = remoteValue1.stringValue;

    // Logic comes here

  } else {
    LogError(@"Error fetching remote configuration from Firebase: %@", error);
}
remoteValue1
不是
nil

value1
nil

remoteValue1.dataValue
\NSZeroData

此外,当我尝试使用

[self.remoteConfig defaultValueForKey:@"key1" namespace:nil]
我得到一个
nil
值(假设将
nil
作为
namespace
参数发送到将给我默认的名称空间默认值)


我在这里做错了什么吗?

configValueForKey:
方法首先检查从Firebase服务器获取结果,如果结果存在,则返回远程结果,而不是默认结果

所以key1值应该是您在控制台中设置的值,即
nil
(无值)


调用
defaultVaueForKey:namespace:
时,应始终使用默认名称空间
FIRNamespaceGoogleMobilePlatform
。使用
nil
将不会返回任何有效的配置结果。

谢谢,我不知何故错过了头文件中的
FIRNamespaceGoogleMobilePlatform
常量。对于Swift开发人员,命名空间是
NamespaceGoogleMobilePlatform
,在
FIRRemoteConfig.h