Search code examples
iosxcodexcode8xcode-ui-testingdyld

Xcode 8: UI tests can't find library being tested


When I created my iOS project, I opted not to include UI tests. Now, though, I tried to add them, but I get the following error when I try to execute them:

dyld: Library not loaded: @rpath/FrameworkBeingTested.framework/FrameworkBeingTested
Referenced from: <redacted>/TargetApplication.app/TargetApplication
Reason: image not found

I've confirmed that:

  • UI tests are included in the Test scheme,
  • the UI test target is set to use the correct Target Application (TargetApplication), and
  • the UI test files are members of the FrameworkBeingTestedUITests target.

Solution

  • I found the answer when I changed the UI test files' target membership to FrameworkBeingTestedTests, instead of FrameworkBeingTestedUITests:

    Error message

    Aha! The problem was that my FrameworkBeingTested had iOS 8.0 as its minimum target, but Apple's UI testing framework requires iOS 9.0 or newer. But instead of telling me that, the compiler told me that it couldn't load the tested library. I'll file a radar for this.

    Hope this helps someone!