xcode 在调试模式下分发 TestFlight 构建

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/47144417/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 10:24:58  来源:igfitidea点击:

Distribute TestFlight build in debug mode

iosxcodetestflight

提问by eirikvaa

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

我们正在为iOS 应用程序的生产开发使用单独的数据库,并且我们正在通过 TestFlight 进行测试。问题是 TestFlight 在发布模式下分发应用程序。

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?

或者我应该为发布和开发设置不同的构建标识符,然后在 TestFlight 中有两个应用程序?

What's normally being done?

平时都在做什么?

采纳答案by Yitzchak

Summary of solution

解决方案总结

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

我建议您在构建设置中添加一个值。PRODUCTION仅在构建生产版本时才将其设置为。

Just use an #ifstatement to check if the PRODUCTIONis set

只需使用#if语句来检查是否PRODUCTION已设置



In my app (I use Batchfor push notifications)

在我的应用程序中(我使用Batch推送通知)

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:

我有同一个应用程序的 2 个版本。一个免费有广告,一个付费没有广告。我只是在免费版本中这样设置:

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 PRODUCTIONin Active Compilation Conditionsonly when building to production. and then add this code:

您可以设置PRODUCTIONActive Compilation Conditions只建设到生产的时候。然后添加以下代码:

#if PRODUCTION
    // Connect to production database
#else
    // Connect to test database
#endif