在调试模式下分发 TestFlight 构建
Distribute TestFlight build in debug mode
我们为生产和开发使用单独的数据库iOS应用程序,我们正在通过 TestFlight 进行测试。
问题是 TestFlight 以发布模式分发应用程序。
如何配置项目以使其在开发模式下分发应用程序?
或者我真的应该为发布和开发设置不同的构建标识符,然后在 TestFlight 中有两个应用程序吗?
平时都在做什么?
Summary of solution
我建议您在构建设置中添加一个值。只有在构建生产版本时才将其设置为 PRODUCTION
。
只需使用 #if
语句检查 PRODUCTION
是否已设置
In my app (I use Batch for push notifications)
我有同一个应用的两个版本。一种是免费的,有广告,一种是付费的,没有广告。
我只是在免费版中这样设置:
在付费版本中像这样:
最后我在代码中使用它=]
// 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应用程序,我们正在通过 TestFlight 进行测试。 问题是 TestFlight 以发布模式分发应用程序。
如何配置项目以使其在开发模式下分发应用程序?
或者我真的应该为发布和开发设置不同的构建标识符,然后在 TestFlight 中有两个应用程序吗?
平时都在做什么?
Summary of solution
我建议您在构建设置中添加一个值。只有在构建生产版本时才将其设置为 PRODUCTION
。
只需使用 #if
语句检查 PRODUCTION
是否已设置
In my app (I use Batch for push notifications)
我有同一个应用的两个版本。一种是免费的,有广告,一种是付费的,没有广告。 我只是在免费版中这样设置:
在付费版本中像这样:
最后我在代码中使用它=]
// 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