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?

drekka
  • 20,957
  • 14
  • 79
  • 135
  • Possible duplicate of [Xcode 7 - Code coverage data generation failed](http://stackoverflow.com/questions/32223965/xcode-7-code-coverage-data-generation-failed) – Max MacLeod Mar 28 '17 at 14:46

1 Answers1

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
Mark
  • 7,167
  • 4
  • 44
  • 68
  • 1
    Thanks, This turned out to be the problem. Xcode really needs to clean this error up as it's not obvious. – drekka Jun 30 '16 at 01:47
  • Doesn't seem to work with XCode 8.1.2.... But anyway give it a try... but who knows maybe it works for someone else... it's such a mess, working with frameworks – Darkglow Feb 13 '17 at 13:19
  • 1
    You have to make sure `$(PROJECT_DIR)/Frameworks` is whatever the directory for your frameworks. For example, if you use Carthage it probably will be `$(PROJECT_DIR)/Carthage/Build/iOS` – runmad Sep 18 '17 at 20:34