Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Distribute TestFlight build in debug mode

We're using separate databases for production and development for our iOS application, and we're testing via TestFlight. The problem is TestFlight distributing the application in release mode.

How can I configure the project so that it distributes the application in development mode?

Or should I actually set different build identifiers for release and development and then have two applications in TestFlight?

What's normally being done?

like image 925
eirikvaa Avatar asked Nov 06 '17 19:11

eirikvaa


1 Answers

Summary of solution

I suggest you to add a value in build settings. You set it to PRODUCTION only when you build your production version.

Just use an #if statement to check if the PRODUCTION is set


In my app (I use Batch for push notifications)

I have 2 versions of the same app. one free with ads, one paid without ads. I just set like this in the free version:

Active Compilation Conditions Setting

And like this in the paid version:

enter image description here

And finally I use it in code =]

    // MARK: Batch.
    #if FREE
        #if DEBUG
            print("Batch FREE - DEBUG mode")
            Batch.start(withAPIKey: "-MY FREE VERSION DEBUG KEY-") // dev
        #elseif RELEASE
            print("Batch FREE - RELEASE mode")
            Batch.start(withAPIKey: "-MY FREE VERSION RELEASE KEY-") // live
        #endif
    #elseif PAID
        #if DEBUG
            print("Batch PAID - DEBUG mode")
            Batch.start(withAPIKey: "-MY PAID VERSION DEBUG KEY-") // dev
        #elseif RELEASE
            print("Batch PAID - RELEASE mode")
            Batch.start(withAPIKey: "-MY PAID VERSION RELEASE KEY-") // live
        #endif
    #endif
    // Register for push notifications
    BatchPush.registerForRemoteNotifications()

In your case it will be manual due.

You set PRODUCTION in Active Compilation Conditions only when building to production. and then add this code:

#if PRODUCTION
    // Connect to production database
#else
    // Connect to test database
#endif
like image 78
Yitzchak Avatar answered Oct 07 '22 16:10

Yitzchak