Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to debug Firebase on iOS AdHoc build

Tags:

The only way to debug Firebase is to pass -FIRAnalyticsDebugEnabled on arguments passed on launch.

It's working in debug mode with my iOS device connected but I would like to deploy an AdHoc build so QA can test it without Xcode.

But it seems arguments aren't passed at launch when Xcode archives a build.

Any solution? Thanks.

like image 410
Antoine Gamond Avatar asked May 03 '17 08:05

Antoine Gamond


People also ask

How do I use debug view in firebase?

Once you enable debug mode on your development devices, navigate to DebugView by selecting the arrow next to StreamView on the top nav of Google Analytics and selecting DebugView. Then, just start using your app to see your app's events being logged in the DebugView report.

How do I enable debug mode?

To enable USB debugging, toggle the USB debugging option in the Developer Options menu. You can find this option in one of the following locations, depending on your Android version: Android 9 (API level 28) and higher: Settings > System > Advanced > Developer Options > USB debugging.

What is debug view firebase Analytics?

The DebugView report shows you data (from events, event parameters, and user properties) as Analytics collects the data. The report can help you set up data collection, troubleshoot issues as issues arise, and understand a user's behavior as the user explores your website or app.


2 Answers

I found hack solution for this, try it in your application:didFinishLaunchingWithOptions: or override AppDelegate’s init:

Objective-C:

NSMutableArray *newArguments = [NSMutableArray arrayWithArray:[[NSProcessInfo processInfo] arguments]]; [newArguments addObject:@"-FIRDebugEnabled"]; [[NSProcessInfo processInfo] setValue:[newArguments copy] forKey:@"arguments"]; 

Swift:

var newArguments = ProcessInfo.processInfo.arguments newArguments.append("-FIRDebugEnabled") ProcessInfo.processInfo.setValue(newArguments, forKey: "arguments") 
like image 189
Dre Sid Avatar answered Sep 21 '22 19:09

Dre Sid


Just some additions to the most upped answer: I would do something like this

#if DEBUG      var newArguments = ProcessInfo.processInfo.arguments         newArguments.append("-FIRDebugEnabled")         ProcessInfo.processInfo.setValue(newArguments, forKey: "arguments") #endif 

to keep it to debug. This takes that you set up -DDEBUG in "Other Swift Flags" in Build Settings. (you need to set this for the Debug value, of course.

And then remember to put the code snippet BEFORE you initialize Firebase :-)

like image 25
Nicolai Harbo Avatar answered Sep 17 '22 19:09

Nicolai Harbo