错误“找不到-lPods-MyProjectTests-KIF的库".在现有工作空间中安装KIF时 [英] Error "library not found for -lPods-MyProjectTests-KIF" when installing KIF in existing workspace

查看:105
本文介绍了错误“找不到-lPods-MyProjectTests-KIF的库".在现有工作空间中安装KIF时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

将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.

这些步骤有效:

  1. MyProject.xcworkspace/从其原始位置向下移
  2. 在新位置运行pod install
  3. MyProject.xcworkspace/移回 还原到原始位置
  4. 在Xcode中,删除其对Pods.xcodeproj/的引用 (因为文件系统中的相对位置已更改)和 重新创建对此的新引用.
  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.

这篇关于错误“找不到-lPods-MyProjectTests-KIF的库".在现有工作空间中安装KIF时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆