Another in a series of posts documenting my process of updating an aging app.
I noticed that the code coverage reports from XCode 8 recently started showing me coverage for
.m files that were in the CocoaPods that I’m using. In this post I document how I fixed that.
I take no credit for this fix, other than persistent Googling. It might be obvious to you, but it cost me an hour of searching, and if this post saves you some time, it will be worth it. The solution comes from this Stack Overflow answer.
Essentially, I modified my Podfile by adding a build setting to disable code coverage for every Pod. I guess I could have done this manually, by modifying the scheme for each Pod target.
# 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
This is how the coverage data looked before the fix:
And this is how the data looks now, after the fix: