Why is the Swift compiler flag not set?

I want some code to be executed only in the release build, but the code does not run when the circuit is configured to use the release configuration.

What am I missing?

I have the following in my delegate deletion didFinishLaunchingWithOptions:

#if RELEASE
    Countly.sharedInstance().startOnCloudWithAppKey(appKey)
    Crittercism.enableWithAppID(appID)
    NSLog("crash logging enabled")
#endif

The settings of the target assembly are as follows: screenshot of the Swift Compiler - Custom Flags section in Xcode

And the circuit is configured to use the Release configuration when the application starts: Screenshot of release scheme configuration in Xcode

+4
source share
2 answers

You will need to set the preprocessor flags explicitly in the "Swift Compiler - Custom Flags", "Other Swift Flags" section.

Please check -

In the absence of preprocessor macros, there is a way to define specific flags of a particular scheme at the project level in an Xcode project

+4

, Swift -D , . -DDEBUG -DRELEASE, .

+2

All Articles