无法使用 CocoaPods 安装 SDWebImage:"ld: library not found for -lSDWebImage"

Can't install SDWebImage with CocoaPods : "ld: library not found for -lSDWebImage"

我正在尝试使用 Cocoapods 将 SDWebImage 导入到我的 iOS 项目中。

所以我安装了 Cocoapods,并在我的项目目录中创建了这个 Podfile :

platform :ios, '7.0'
target 'MyProjectV6' do
pod 'SDWebImage', '~>3.7'
end

然后我用 pod install 命令 运行 它,一切似乎都很好 :

Analyzing dependencies
Downloading dependencies
Installing SDWebImage 3.7.5 (was 3.7.5)
Generating Pods project
Integrating client project
Sending stats
Pod installation complete! There is 1 dependency from the Podfile and 1 total pod installed.

我还在 Xcode 中看到在我的项目目录中创建了一个 Pods 文件夹。它包含两个 .xcconfig 文件,如下所示:

GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/SDWebImage"
OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/SDWebImage"
OTHER_LDFLAGS = $(inherited) -ObjC -l"SDWebImage" -framework "ImageIO"
PODS_ROOT = ${SRCROOT}/Pods

但是当我构建我的项目时,我得到这个错误:

我也有一个 "libPods-MyProjectV6.a" 添加到我的 Frameworks 文件夹中,但是文本是红色的,所以我猜有些地方不对,但我不知道是什么...

感谢您的帮助。

您打开的是Workspace还是Project文件? 确认您打开第一个

你试过吗?

rm -rf Pods/ Podfile.lock
pod install