4

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!

2
  • Can't you just add it as a launch argument in your scheme? Commented Apr 9, 2019 at 11:10
  • @andlin yes that is an option but as I work in an agency we don't want to think about it on every project when making builds. Thats why I would like a code block or script that handles it for us to reduce human error. Commented Apr 9, 2019 at 11:31

1 Answer 1

10

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")
Sign up to request clarification or add additional context in comments.

1 Comment

Awesome! That seems to work, just need to wrap it in #if DEBUG || STAGING and its exactly what I wanted. Thanks @andlin

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.