如何从Xcode中的代码覆盖范围中排除Pod [英] How to exclude Pods from Code Coverage in Xcode

查看:133
本文介绍了如何从Xcode中的代码覆盖范围中排除Pod的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法从代码覆盖范围排除 Pod?

我希望只看到我编写的代码的代码覆盖率。

Is there a way to exclude Pods from Code Coverage?
I would like to see Code Coverage only for the code I've written.

不是它应该重要,但我正在使用Xcode 8。

Not that it should matter, but I'm using Xcode 8.

推荐答案

这些步骤将有所帮助:

1. 将这些行添加到Podfile

1. add these lines to Podfile

# Disable Code Coverage for Pods projects
post_install do |installer_representation|
    installer_representation.pods_project.targets.each do |target|
        target.build_configurations.each do |config|
            config.build_settings['CLANG_ENABLE_CODE_COVERAGE'] = 'NO'
        end
    end
end

2。运行 pod install

现在你不会在测试覆盖范围内看到pod。

Now you won't see pods in test coverage.

注意:它只排除了Objective-c pod而不是Swift

Note: It only excludes Objective-c pods but not Swift

这篇关于如何从Xcode中的代码覆盖范围中排除Pod的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆