In my project, I try to fetch a value from remote config but the fetch callback was not called. Here is my code:
RCT_EXPORT_METHOD(getString:(NSString *)string :(RCTResponseSenderBlock)callback) {
long expirationDuration = 3600;
if (self.remoteConfig.configSettings.isDeveloperModeEnabled) {
expirationDuration = 0;
}
[self.remoteConfig fetchWithExpirationDuration:expirationDuration completionHandler:^(FIRRemoteConfigFetchStatus status, NSError *error) {
if (status == FIRRemoteConfigFetchStatusSuccess) {
[self.remoteConfig activateFetched];
NSString *result = self.remoteConfig[string].stringValue;
callback(@[[NSNull null], result]);
} else {
callback(@[[NSNull null], [NSNull null]]);
}
}];
}
Please help, thanks!
Hi @EthanDoan your call to fetchWithExpirationDuration looks good to me. However could you explain what is happening with NSString *result = self.remoteConfig[string].stringValue;. That is not a valid statement with the Remote Config SDK.
@kroikie The statement is valid but I wrong put it there. But even if I remove it, the callback's still not called.
Can you set the log level to FIRLogLevelDebug and share the logs when this happens? Also, can you share a sample project that reproduces this?
Here is the FIRLog:
2018-03-30 14:54:01.674860+0700 FrogPlay[3676:158677] 4.10.1 - [Firebase/Analytics][I-
ACS031006] View controller already tracked. Class, ID: UIViewController, -3790160624073249039
2018-03-30 14:54:02.225 [info][tid:com.facebook.react.JavaScript] Running application "FrogPlay"
with appParams: {"rootTag":1,"initialProps":{}}. __DEV__ === false, development-level warning are
OFF, performance optimizations are ON
2018-03-30 14:54:02.225525+0700 FrogPlay[3676:158681] Running application "FrogPlay" with
appParams: {"rootTag":1,"initialProps":{}}. __DEV__ === false, development-level warning are OFF,
performance optimizations are ON
2018-03-30 14:54:02.247631+0700 FrogPlay[3676:158662] 4.10.1 - [Firebase/InstanceID][I-
IID013010] InstanceID library version 2.0.9
2018-03-30 14:54:02.280904+0700 FrogPlay[3676:158662] 4.10.1 - [Firebase/InstanceID][I-
IID015013] Successfully removed all IID tokens
2018-03-30 14:54:02.281160+0700 FrogPlay[3676:158662] 4.10.1 - [Firebase/RemoteConfig][I-
RCN000024] Success to get device authentication ID: 4704593247591040516, security token:
7080383854754225082.
2018-03-30 14:54:02.476601+0700 FrogPlay[3676:158677] 4.10.1 - [Firebase/Analytics][I-
ACS031006] View controller already tracked. Class, ID: UIViewController, -3790160624073249039
This is currently happen with my company project. I will try to provide a sample project soon.
hi @morganchen12
Here is sample project for the issue.
https://github.com/EthanDoan/ios-remote-config-callback-not-called
When I try to create another app to work with same firebase account, remote config works perfectly. But in this sample, fetch callback was never called.
Please support, thank you!
Problem solved.
Turning out that I forgot to add [FIRapp configure] in AppDelegate.m
Thanks
Most helpful comment
Problem solved.
Turning out that I forgot to add [FIRapp configure] in AppDelegate.m
Thanks