ios Cocoapods 找不到标题 xcode 6
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/26095775/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Cocoapods can't find header xcode 6
提问by Ptitaw
I have a problem xcode can't find the headers of my pods in my wokspace.
我有一个问题 xcode 在我的 wokspace 中找不到我的 pod 的标题。
The headers search path for the target seems ok
目标的标题搜索路径似乎没问题
Here is the content of my podfile
这是我的 podfile 的内容
target "MyApp" do
pod 'AFNetworking', '~> 2.0'
pod 'Reachability'
pod 'ViewDeck', '2.2.11'
pod 'MBProgressHUD', '~> 0.8'
end
But when i build the project i have this error in the prefix.pch
但是当我构建项目时,我在 prefix.pch 中有这个错误
/Users/...../MyApp-Prefix.pch:17:13: 'AFNetworking.h' file not found
/Users/...../MyApp-Prefix.pch:17:13: 'AFNetworking.h' 文件未找到
I have tried to add platform :ios, "8.0"
in my podfile and do a pod update
but still no luck
我试图添加platform :ios, "8.0"
到我的 podfile 中并做了一个pod update
但仍然没有运气
I have also tried to add $(inherited) like suggested in the SO question : Xcode 6 doesn´t find cocoapods libraries
我还尝试添加 $(inherited) 就像在 SO 问题中建议的那样: Xcode 6 找不到 cocoapods 库
I'm using xcode 6 on mavericks
我在小牛队上使用 xcode 6
回答by Simón Internacional
I found solution. In your project properties replace this:
我找到了解决方案。在您的项目属性中替换这个:
回答by jwswart
You might also want to link your pods with both your targets like so:
您可能还想将您的 pod 与您的两个目标链接起来,如下所示:
platform :osx, '10.7'
link_with 'MyApp', 'MyApp Tests'
pod 'AFNetworking', '~> 1.0'
pod 'Objection', '0.9'
From Cocoapods docsand this answer
Update: This no longer works for Cocoapods 1.0+, the correct way to implement the Podfile is:
更新:这不再适用于 Cocoapods 1.0+,实现 Podfile 的正确方法是:
platform :ios, '9.0'
inhibit_all_warnings!
target 'MyApp' do
pod 'ObjectiveSugar', '~> 0.5'
target "MyAppTests" do
inherit! :search_paths
pod 'OCMock', '~> 2.0.1'
end
end
Source: https://guides.cocoapods.org/syntax/podfile.html#podfile
来源:https: //guides.cocoapods.org/syntax/podfile.html#podfile
回答by Stefan Arn
I was able to fix this in my project. I had a second target for tests. I never used this target and the error disappeared after I deleted it from the project. So maybe not your main target is the source of the problem, but another one.
我能够在我的项目中解决这个问题。我有第二个测试目标。我从未使用过这个目标,从项目中删除它后错误消失了。所以也许你的主要目标不是问题的根源,而是另一个。
回答by Oscar
I agree with jwswart's answer because quite many times I have realized that the issue with just defining dependencies for the 'MyApp' and leaving out 'MyAppTests' as in:
我同意 jwswart 的回答,因为很多次我都意识到只为“MyApp”定义依赖项而忽略“MyAppTests”的问题,如下所示:
target :'MyApp' do
..
end
目标:'MyApp' 做
..
结尾
breaks the build process because the classes defined in 'MyApp' make use of the dependencies which are not visible in the 'MyAppTests'. Thus as jwswart suggested:
中断构建过程,因为“MyApp”中定义的类使用了“MyAppTests”中不可见的依赖项。因此,正如 jwswart 建议的那样:
link_with 'MyApp', 'MyApp Tests'
link_with 'MyApp', 'MyApp 测试'
回答by Victor Choy
Just have a try to comment this line for your target
尝试为您的目标评论此行
# use_frameworks!
~~
~~