问题描述
我已按照TestFlight中的说明复制发布配置。另外,我使用TestFlight SDK从我的应用程序获取实时报告。通过这样做,我不得不在我的应用程序中包括一些TestFlight代码。当然,我不想在我的应用程序的发布版本中有这样的代码。
I've followed the instructions from TestFlight to duplicate the "release" configuration. Also I'm using TestFlight SDK to get live reports from my app. By doing this I had to include some TestFlight code in my application. Of course I don't want to have this code in my release version of my app.
有一些方法只包括这个代码在testflight配置(复制释放配置)?对于调试配置,您可以使用 #ifdef DEBUG
执行相同的操作(或者我必须为此创建一个单独的目标,并且只在该目标中包含TestFlight SDK)
Is there some way to only include this code in the testflight configuration (the duplicated release configuration)? The same way you can do with #ifdef DEBUG
for the debug configuration (or do I have to create a separate target for this and only include the TestFlight SDK in that target?)
推荐答案
您可以使用 #ifdef
语句,因为我们建议您使用HockeyApp服务:
You can exclude code from running using #ifdef
statements pretty easily, as we suggest it for our HockeyApp service here: http://support.hockeyapp.net/kb/client-integration/crash-reporting-on-ios-quincykit
基本上是:
-
为所有配置的Xcode项目添加预处理器宏:
CONFIGURATION _ $(CONFIGURATION)
然后,您将能够使用这些代码行仅包含特定配置的代码:
Then you will be able to use these lines of code to include code only for a specific configuration:
#if defined (CONFIGURATION_Beta)
// YOUR CODE
#endif
这会将 Beta
替换为只包含代码的配置名称
This replace Beta
with the name of your configuration that should include the code only
上面的链接提供了有关如何执行操作的图像和更详细的文本。由于您将只在您的测试版发布配置中使用该库,因此您不需要为已经创建的测试版发布配置创建另一个配置。
The link above provides images and more detailed text on how to do it. Since you will use that library only in your beta distribution configuration, you don't need to create another configuration besides the already created one for beta distribution.
您需要一个用于调试的配置,用于开发,一个用于beta分发以设置adhoc权利,一个用于应用商店分配。最后两个通常是发布配置的变体。
You need to have one configuration for debug, which is for development, one for beta distribution to set the adhoc entitlements and one for app store distribution. The last two are usually variations of the release configuration.
这篇关于Objective-C - 具有TestFlight配置以包括TestFlight SDK的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!