exponea/exponea-ios-sdk

Self check not working

Closed this issue · 4 comments

Self check does not work, because we check if we are running a debug version of the app.

The code to check that we are running a debug version uses an outdated technique that doesn't seem to work.

From BuildConfiguration.swift:

// based on https://forums.swift.org/t/support-debug-only-code/11037

func inDebugBuild(_ code: () -> Void) {
    assert({
        code()
        return true
        }()
    )
}

Since the SDK is a dependency of our application, the assert will never run. Therefore this function wouldn't work as expected.

Hi @saiefelgebali thank you for report. I assume that this is not working on XCode 14.3 right?
Yes, this code is obsolete due to historical reasons - we'll update a solution

Hi, what is your optimization level for debug in build settings please?

@saiefelgebali Hi, could you check your setup of optimization level according to comment form @Ankmara ? thank you

Hello,

The Swift Compiler optimization level is set to No Optimization [-Onone].

Does that make a difference to why this bug is happening?