Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to pass command line argument to Xcode based on build configuration

I would like to add the -FIRDebugEnabled argument to enable the debug view on the Firebase console but only when it is a debug or staging build.

I have tried adding CommandLine.arguments.append("-FIRDebugEnabled") in application didFinishLaunchingWithOptions but this does not seem to work, so I think I need to add it during a Build phase or a pre-action in the release scheme. But I can't figure it out.

Thanks in advance!

like image 727
Bob De Kort Avatar asked Oct 23 '25 10:10

Bob De Kort


1 Answers

If I understand things correctly, launch arguments added to a scheme are only set when building the app from within Xcode directly to a device or the simulator. If you wish to set FIRDebugEnabled in other cases (so that it's also set when the user launches the app on the actual device), maybe this will work:

var newArguments = ProcessInfo.processInfo.arguments
newArguments.append("-FIRDebugEnabled")
ProcessInfo.processInfo.setValue(newArguments, forKey: "arguments")
like image 135
rodskagg Avatar answered Oct 25 '25 23:10

rodskagg



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!