Search code examples
xcode6integration-testingcocoapodsldkif

Error "library not found for -lPods-MyProjectTests-KIF" when installing KIF in existing workspace


I run into this error when adding KIF to an existing Xcode 6 workspace:

ld: library not found for -lPods-MyProjectTests-KIF

What may be special about my situation that MyProject.xcworkspace/ resides in the parent directory of MyProject.xcproject/ (and depends on several other sibling projects as well):

./MyProject.xcworkspace/
./MyProject/
./MyProject/MyProject.xcworkspace/
./MyProject/Podfile

My Podfile is as follows:

target 'MyProjectTests', :exclusive => true do
  pod 'KIF', '~> 3.0', :configurations => ['Debug']
  workspace 'MyProject'
end

When I run pod --project-directory=./MyProject install and open MyProject.xcworkspace the target MyProject still compiles but I get the cited link error when building MyProjectTests.

How can I overcome that problem?

UPDATE My guess by now is that some settings are not inherited correctly from Pods-MyProjectTests.*.xcconfig perhaps due to previous edits that removed $(inherited)s at the project or target level in some places (although this should normally produce warnings).


Solution

  • My initial guess (in the updated question) was wrong. pod ... install created a new MyProject.xcworkspace\ as sibling to Podfile, not modify the one in the current directory. I had assumed the second by mistake.

    These steps worked:

    1. move MyProject.xcworkspace/ down from its original location
    2. run pod install in the new location
    3. move MyProject.xcworkspace/ back to its original location
    4. in Xcode, delete its reference to Pods.xcodeproj/ (because the relative locations in the file system have changed) and recreate new reference to it.

    Since this is a bit cumbersome I have also posted a new question.