在调试模式下分发TestFlight构建

eir*_*vaa 5 xcode ios testflight

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

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

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

通常做什么?

Yit*_*hak 5

解决方案总结

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

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


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

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

主动编译条件设置

在付费版本中是这样的:

在此处输入图片说明

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

    // 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()
Run Code Online (Sandbox Code Playgroud)

在您的情况下,它将是手动到期。

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

#if PRODUCTION
    // Connect to production database
#else
    // Connect to test database
#endif
Run Code Online (Sandbox Code Playgroud)