Objective-C – Having a TestFlight configuration to include TestFlight SDK

岁酱吖の 提交于 2019-12-04 14:06:29

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

Basically it is:

  1. Add a preprocessor macro to your Xcode project for all configurations: CONFIGURATION_$(CONFIGURATION)

  2. 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
    
  3. 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.

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.

I think you'd have to create a separate build configuration and use something like #ifdef TESTFLIGHT. You should add a macro for that configuration so it's defined only for the TestFlight configuration.

My solution to this is to have a separate branch in Git for the Testflight version which includes the SDK and calls in the code, headers, etc.

I then do all my work on the main branch and keep the Testflight branch up to date with these changes. That way I don't have to include libraries or headers that I don't use in my shipping version.

It's simpler than it sounds.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!