How can I detect if build is debug on iOS?


I would like to enable Fabric only for debug versions of app.
How can I translate the ObjC code visible below into Java?

#ifdef DEBUG

Have a great day,

Not entirely like the Objective C macro, but it works for what you want:

In Xcode, do Edit Schemeā€¦ -> Run -> Arguments and you can pass any arbitrary environment variable like DEBUG: true for example. Then in you Java code, get it from: NSProcessInfo.processInfo().environment()

Or from that same place you can also add it as a launch argument, for example: -Ddebug=true, and in Java get it from NSProcessInfo.processInfo().arguments()

You can version control these scheme settings by ticking the Shared box, which will add it as xcshareddata inside your .xcodeproj