ios CocoaPods with XCode 6.0.1 - 如何修复显示为红色的 Pods 框架?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/26246805/
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 with XCode 6.0.1 - How can I fix Pods Frameworks appearing in red?
提问by Ryan Hoegg
I have created a new project in Xcode 6.0.1 and created the following Podfile:
我在 Xcode 6.0.1 中创建了一个新项目并创建了以下 Podfile:
source 'https://github.com/CocoaPods/Specs'
platform :ios, '8.0'
pod 'AFNetworking', '~> 2.0'
I then ran pod install
, and opened the xcworkspace in Xcode. When I build the project, all the frameworks appear in red. For example, under the Pods project, the Foundation.framework appears in red, and refers to a path on my computer that doesn't exist:
然后我运行pod install
,并在 Xcode 中打开 xcworkspace。当我构建项目时,所有框架都显示为红色。比如Pods项目下Foundation.framework显示为红色,指的是我电脑上不存在的路径:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk/System/Library/Frameworks/Foundation.framework
My question is: How can I get the frameworks to appear in black in the navigator, and properly link my pods to my main project?
我的问题是:如何让框架在导航器中显示为黑色,并将我的 pod 正确链接到我的主项目?
I have made a couple changes mentioned in the answers to this question:
我在这个问题的答案中提到了一些变化:
Originally, the libpods.a Product appeared in red as well. I fixed that by changing the Per-configuration Build Products Pathto
$(BUILD_DIR)/$(CONFIGURATION)
after reading that someone else fixed their problem that way.I have made sure my Base SDKis iOS 8.0 on all the targets I can find.
I have verified that my Valid Architecturesare set to "arm64 armv7 armv7.1" for all the targets I can find.
最初,libpods.a 产品也显示为红色。在阅读其他人以这种方式解决了他们的问题之后,我通过将Per-configuration Build Products Path更改为来
$(BUILD_DIR)/$(CONFIGURATION)
解决这个问题。我已经确保我的Base SDK在我能找到的所有目标上都是 iOS 8.0。
我已经验证,对于我能找到的所有目标,我的有效架构都设置为“arm64 armv7 armv7.1”。
回答by H6.
I had the same strange problem, where the libraries where correctly recognized on one machine, but not on another - there they were also in red.
我遇到了同样奇怪的问题,在一台机器上正确识别的库,但在另一台机器上却没有 - 它们也是红色的。
The solution was to add the Pods
target to the building scheme ("Product > Scheme > Edit Scheme..." then add with + the Pods main target and put it in front of your main target.)
Then clean
and build
the project.
解决方案是将Pods
目标添加到构建方案中(“产品 > 方案 > 编辑方案...”然后添加 + Pods 主要目标并将其放在您的主要目标前面。)然后clean
和build
项目。
回答by euthimis87
This is normal, since these frameworks don't exist in the pod's project path. As I see in tmpios->Frameworks doesn't appear in any of the frameworks that are supposed to exist. Choose your project,then Target->tmpios->Build Phases->Link Binary With Libraries and there add the frameworks you need.
这是正常的,因为这些框架不存在于 pod 的项目路径中。正如我在 tmpios->Frameworks 中看到的那样,没有出现在任何应该存在的框架中。选择您的项目,然后 Target->tmpios->Build Phases->Link Binary With Libraries,然后添加您需要的框架。
If still you have a compile error and doesn't find libraries of pods then write your pod file in that way:
如果仍然有编译错误并且没有找到 pod 库,那么以这种方式编写 pod 文件:
source 'https://github.com/CocoaPods/Specs'
link_with ['tmpios', 'tmpiosTests']
platform :ios, '8.0'
pod 'AFNetworking', '~> 2.0'
Install pods, and at your project Target->tmpios->Build Setting->Other Linker Flags, add $(inherited).
安装 pod,并在您的项目 Target->tmpios->Build Setting->Other Linker Flags 中添加 $(inherited)。
回答by OAK
Just delete all configs in the the Pods Group in xcode and run pod install again. This will regenerate the xcconfigs files. Then make sure they are set properly in the Project > Info > Configurations
只需删除 xcode 中 Pods Group 中的所有配置,然后再次运行 pod install。这将重新生成 xcconfigs 文件。然后确保它们在 Project > Info > Configurations 中正确设置
回答by A.J. Hernandez
I had the same problem. It turns out I just need to run a pod update with
我有同样的问题。事实证明我只需要运行一个 pod 更新
sudo gem install cocoapods
回答by Roger.L
I had the same problem.And resolved by changing the path of the 'red framework'.because the path shows 'SDK IOS9' before.So i set the framework location 'relative to SDK' and choose the right framework location manually.and it works temporarily.
我有同样的问题。并通过更改“红色框架”的路径解决。因为路径之前显示“SDK IOS9”。所以我将框架位置设置为“相对于 SDK”并手动选择正确的框架位置。暂时工作。
I guess the reason is that i updated to Xcode 8,but my coacopods is still old version,so it set the location with IOS9 which cause this problem.
我想原因是我更新到了 Xcode 8,但是我的 coacopods 仍然是旧版本,所以它用 IOS9 设置了导致这个问题的位置。