Search code examples
xcodeswift-package-manager

dyld: Library not loaded: @rpath/XCTest.framework/XCTest after adding Nimble in SPM


I have a workspace that has a 3 different projects. My dependencies look like this:

- App 1
- App 2
- Shared libraries

After adding Nimble to my shared library project, it compiles, but I always get a crash saying:

dyld: Library not loaded: @rpath/XCTest.framework/XCTest 

I checked my Search Path Frameworks and Other Linked Flags of my apps, but there's no XCTest, and I don't want XCTest to be in there. Why am I getting this error?


Solution

  • Turns out I added Nimble as a dependency in my shared library. I meant to put it in the testing target, but accidentally put it in the main target.

    When I go to Project > Swift Packages and see Nimble, it does not specify which target my package belongs in, which spurred the confusion.