I am unable to view analytics debug view after I install the app through TestFlight into my test phone.
I have passed in argument -FIRDebugEnabled, and have tried -FIRAnalyticsDebugEnabled but no luck.
-FIRDebugEnabled -FIRAnalyticsDebugEnabled
If I directly installed the app into my test phone through Xcode, the debug view will be available. But if it's installed through TestFlight, the debug view cannot be seen.
Add following code at the first line of application:didFinishLaunchingWithOptions:
method of AppDelegate
file
CommandLine.arguments.append(contentsOf: ["-FIRDebugEnabled", "-FIRAnalyticsDebugEnabled"])
This can be done by injecting special flags into Firebase's local storages. -FIRDebugEnabled
command line argument is being checked by both: FirebaseCore and FirebaseAnalytics frameworks. While the former is saving the flag into shared UserDefaults
, the latter is using APMUserDefaults
private class, which can be accessed in runtime:
if let APMUserDefaults = NSClassFromString("APMUserDefaults") as AnyObject?,
let userDefaults = APMUserDefaults.perform(#selector(getter: UserDefaults.standard))?.takeUnretainedValue() {
_ = userDefaults.perform(#selector(NSMutableDictionary.setObject(_:forKey:)),
with: true,
with: "/google/measurement/debug_mode")
}
UserDefaults.standard.set(true, forKey: "/google/firebase/debug_mode")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With