问题
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).
回答1:
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:
- move
MyProject.xcworkspace/down from its original location - run
pod installin the new location - move
MyProject.xcworkspace/back to its original location - 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.
来源:https://stackoverflow.com/questions/28497959/error-library-not-found-for-lpods-myprojecttests-kif-when-installing-kif-in-e