ios - 在 Debug模式下分发 TestFlight 构建

标签 ios xcode testflight

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

如何配置项目以便它在开发模式下分发应用程序?

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

通常做什么?

最佳答案

Summary of solution

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

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


In my app (I use Batch for push notifications)

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

Active Compilation Conditions Setting

在付费版本中是这样的:

enter image description here

最后我在代码中使用了它 =]

    // 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.

只有在构建到生产环境时,您才能在 Active Compilation Conditions 中设置 PRODUCTION。 然后添加这段代码:

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

关于ios - 在 Debug模式下分发 TestFlight 构建,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47144417/

相关文章:

ios - Beta外部测试中的应用程序可以更新吗?

iphone - 使用 AudioQueueGetProperty 检索记录格式时出现一般参数错误

ios - 克隆 UIImage 对象时 UIImage 文件太多

ios - 在没有 Storyboard 的情况下在 UIView 中添加 UICollectionView

android - Flutter iOS 应用程序 - 在 TestFlight 中测试应用程序升级

iphone - 我真的需要为 TestFlight 创建一个 AdHoc Distribution Build 吗?

ios - 修改 NSObjects 的内部属性(特别是 SKPaymentTransaction)

iphone - 在 MapView 上点击注释时隐藏弹出窗口

iOS 键盘延迟动画

ios - 重定向到 Twitter 登录的设置屏幕