错误“找不到-lPods-MyProjectTests-KIF的库".在现有工作空间中安装KIF时 [英] Error "library not found for -lPods-MyProjectTests-KIF" when installing KIF in existing workspace
问题描述
将KIF添加到现有Xcode 6工作区时遇到此错误:
I run into this error when adding KIF to an existing Xcode 6 workspace:
ld: library not found for -lPods-MyProjectTests-KIF
MyProject.xcworkspace/
驻留在MyProject.xcproject/
的父目录中(并且还取决于其他几个同级项目)可能对我的情况有什么特殊之处:
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
我的Podfile
如下:
target 'MyProjectTests', :exclusive => true do
pod 'KIF', '~> 3.0', :configurations => ['Debug']
workspace 'MyProject'
end
当我运行pod --project-directory=./MyProject install
并打开MyProject.xcworkspace
时,目标MyProject
仍然可以编译,但是在构建MyProjectTests
时出现引用的链接错误.
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?
更新我现在的猜测是某些设置不是 可能是由于先前的编辑在某些地方或项目级别上删除了$(inherited)
的原因(尽管通常这会产生
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).
推荐答案
我的最初猜测(在更新的问题中)是错误的. pod ... install
创建了一个新的MyProject.xcworkspace\
作为与Podfile
的同级,而不修改当前目录中的那个.我误以为是第二个.
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.
这些步骤有效:
- 将
MyProject.xcworkspace/
从其原始位置向下移 - 在新位置运行
pod install
- 将
MyProject.xcworkspace/
移回 还原到原始位置 - 在Xcode中,删除其对
Pods.xcodeproj/
的引用 (因为文件系统中的相对位置已更改)和 重新创建对此的新引用.
- move
MyProject.xcworkspace/
down from its original location - run
pod install
in 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.
这篇关于错误“找不到-lPods-MyProjectTests-KIF的库".在现有工作空间中安装KIF时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!