XCode:代码覆盖率数据生成失败 [英] XCode: Code coverage data generation failed

查看:56
本文介绍了XCode:代码覆盖率数据生成失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试运行单元测试时,我遇到了这个在 Objective-C 项目中出现的可怕问题.我已经尝试了以下所有内容(根据各种 SOF 帖子):

I've encountered this dreaded problem popping up on an Objective-C project when I attempt to run unit tests. I've tried all of the following (as per various SOF postings):

  • 清除派生数据
  • 删除 ~/Library 中的所有模拟器设置
  • 重启 XCode
  • 重新启动 MBP
  • 多次重置模拟器
  • 更改为不同的模拟器(甚至是我从未使用过的尝试过的模拟器)

我检查了控制台日志,发现了这个:

I checked the console logs and found this:

  26/06/2016 9:20:10.973 PM com.apple.debugserver-@(#)PROGRAM:debugserver  PROJECT:debugserver-350.0.21.9
  [7768]: 1 +0.000000 sec [1e58/1003]: error: ::read ( 3, 0x700000080a40, 1024 ) => -1 err = Bad file descriptor (0x00000009)

我没有使用 Cocoapods.

I'm not using Cocoapods.

有人知道下一步要尝试什么吗?

Anyone have any ideas what to try next?

推荐答案

您是否在您的应用中使用第三方框架?我在项目中链接到第三方框架并尝试运行测试时注意到了这个问题.

Do you use a third party framework in your app? I noticed this issue when linking to a third party framework in my project and trying to run tests.

问题是测试包在运行时找不到框架.您可以通过添加 $(PROJECT_DIR)/Frameworks(假设您将框架保留在该位置)来更新测试目标的 Runpath Search Paths 构建设置来解决此问题.

The problem is the test bundle can't find the framework at runtime. You can solve this by updating your test target's Runpath Search Paths build setting by adding $(PROJECT_DIR)/Frameworks (assuming you keep your frameworks at that location).

可以通过以下步骤找到设置:

The setting can be found by following the below steps:

Project file -> Test target -> Build Settings -> Runpath Search Paths

这篇关于XCode:代码覆盖率数据生成失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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