CocoaPods with XCode 6.0.1 - How can I fix Pods Fr

2019-02-04 10:13发布

I have created a new project in Xcode 6.0.1 and created the following 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:

/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?

Xcode screenshot

I have made a couple changes mentioned in the answers to this question:

  1. Originally, the libpods.a Product appeared in red as well. I fixed that by changing the Per-configuration Build Products Path to $(BUILD_DIR)/$(CONFIGURATION) after reading that someone else fixed their problem that way.

  2. I have made sure my Base SDK is iOS 8.0 on all the targets I can find.

  3. I have verified that my Valid Architectures are set to "arm64 armv7 armv7.1" for all the targets I can find.

5条回答
聊天终结者
2楼-- · 2019-02-04 10:29

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.

查看更多
甜甜的少女心
3楼-- · 2019-02-04 10:29

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.

If still you have a compile error and doesn't find libraries of pods then write your pod file in that way:

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

查看更多
兄弟一词,经得起流年.
4楼-- · 2019-02-04 10:37

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

查看更多
小情绪 Triste *
5楼-- · 2019-02-04 10:39

I had the same problem. It turns out I just need to run a pod update with

sudo gem install cocoapods
查看更多
来,给爷笑一个
6楼-- · 2019-02-04 10:52

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.

enter image description here

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.

查看更多
登录 后发表回答