XCode: Code coverage data generation failed

3

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):

  • Clearing derived data
  • Deleting all simulator setups in ~/Library
  • Restarting XCode
  • Restarting MBP
  • Resetting the simulator multiple times
  • Changing to a different simulator (even tried ones I've never used)

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)

I'm not using Cocoapods.

Anyone have any ideas what to try next?

xcode
unit-testing
asked on Stack Overflow Jun 26, 2016 by drekka

1 Answer

10

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.

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
answered on Stack Overflow Jun 30, 2016 by Mark

User contributions licensed under CC BY-SA 3.0