An addition to the previous answers and for React Native users looking for this, if you are using a library like react-native-config, you can use an env variable to switch this on/off.
Environment variables file example
ANALYTICS_DEBUG=true
In your AppDelegate.mm, inside the didFinishLaunchingWithOptions
method:
NSString *analyticsDebug = [ReactNativeConfig envFor:@"ANALYTICS_DEBUG"];
if (analyticsDebug != nil && [analyticsDebug isEqualToString:@"true"]) {
NSProcessInfo *processInfo = [NSProcessInfo processInfo];
NSArray *arguments = [processInfo arguments];
NSMutableArray *newArguments = [NSMutableArray arrayWithArray:arguments];
[newArguments addObject:@"-FIRDebugEnabled"];
[newArguments addObject:@"-FIRAnalyticsDebugEnabled"];
[[NSProcessInfo processInfo] setValue:[newArguments copy] forKey:@"arguments"];
}
// Setup Firebase
[FIRApp configure];
Make sure you setup Firebase after, otherwise this won't work.