4

我正在尝试使用 Countly 从我的最终二进制文件中排除 IDFA,因此我可以对出口合规性问题“您的应用程序使用 IDFA 吗?”回答否。

像这里提到的那样添加COUNTLY_EXCLUDE_IDFA=1是行不通的。Build Settings > Preprocessor Macros

我已将其范围缩小到#ifndef不符合预期。这是我尝试过的:

COUNTLY_EXCLUDE_IDFA=1添加在Build Settings > Preprocessor Macros

#ifndef COUNTLY_EXCLUDE_IDFA
    printf("!EXCLUDED\n");
#else
    printf("EXCLUDED\n");
#endif

>> prints !EXCLUDED

COUNTLY_EXCLUDE_IDFA没有定义在Build Settings > Preprocessor Macros

#ifndef COUNTLY_EXCLUDE_IDFA
    printf("!EXCLUDED\n");
#else
    printf("EXCLUDED\n");
#endif

>> prints !EXCLUDED

#ifndef如果未定义宏,我希望包含一个块。现在#ifndef无论我是否在Build Settings > Preprocessor Macros.

4

2 回答 2

1

请确保您设置COUNTLY_EXCLUDE_IDFA了正确的目标和构建配置。

如果您将 Countly iOS SDK 源文件直接添加到您的项目中,请确保将标志添加到您的应用程序目标中。

如果要将其添加为框架,请确保将标志添加到框架目标。

于 2019-07-20T05:34:19.233 回答
0

我有这个Podfile,它工作正常。

post_install do |installer|
  installer.pods_project.targets.each do |target|
    if target.name == "Countly"
      target.build_configurations.each do |config|
          config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= ['$(inherited)', 'COUNTLY_EXCLUDE_IDFA=1']
      end
    end
  end
end
于 2019-09-03T13:35:09.620 回答