ios - ld : framework not found Alamofire

标签 ios xcode cocoapods alamofire

我花了几天时间尝试解决这个问题,现在我的想法已经用完了。

我有:
Xcode v8.2.1
Apple Swift 版本 3.0.2 (swiftlang-800.0.63 clang-800.0.42.1)
cocoapods-1.2.0

我正在创建新的 Xcode 项目(单 View 应用程序),选择清理和构建 - 一切都很顺利。

在根项目路径中的 pod init 之后,我正在编辑我的 Podfile,如下所示:

# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '10.0'
use_frameworks!

target 'test' do
  # Comment the next line if you're not using Swift and don't want to use dynamic frameworks
    pod 'Alamofire', '~> 4.4'

  # Pods for test

end

现在,当我尝试清理和重建应用程序时,出现构建错误,如下所示:

d /Users/Dawid/Library/Developer/Xcode/DerivedData/test-auxygswgvxhnqfamjqqncqxaieqk/Build/Products/Debug-iphonesimulator/test.app/test normal x86_64
    cd /Users/Dawid/xCode/test
    export IPHONEOS_DEPLOYMENT_TARGET=10.2
    export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator10.2.sdk -L/Users/Dawid/Library/Developer/Xcode/DerivedData/test-auxygswgvxhnqfamjqqncqxaieqk/Build/Products/Debug-iphonesimulator -F/Users/Dawid/Library/Developer/Xcode/DerivedData/test-auxygswgvxhnqfamjqqncqxaieqk/Build/Products/Debug-iphonesimulator -F/Users/Dawid/Library/Developer/Xcode/DerivedData/test-auxygswgvxhnqfamjqqncqxaieqk/Build/Products/Debug-iphonesimulator/Alamofire -filelist /Users/Dawid/Library/Developer/Xcode/DerivedData/test-auxygswgvxhnqfamjqqncqxaieqk/Build/Intermediates/test.build/Debug-iphonesimulator/test.build/Objects-normal/x86_64/test.LinkFileList -Xlinker -rpath -Xlinker @executable_path/Frameworks -Xlinker -rpath -Xlinker @loader_path/Frameworks -Xlinker -rpath -Xlinker @executable_path/Frameworks -mios-simulator-version-min=10.2 -dead_strip -Xlinker -object_path_lto -Xlinker /Users/Dawid/Library/Developer/Xcode/DerivedData/test-auxygswgvxhnqfamjqqncqxaieqk/Build/Intermediates/test.build/Debug-iphonesimulator/test.build/Objects-normal/x86_64/test_lto.o -Xlinker -export_dynamic -Xlinker -no_deduplicate -Xlinker -objc_abi_version -Xlinker 2 -fobjc-link-runtime -L/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator -Xlinker -add_ast_path -Xlinker /Users/Dawid/Library/Developer/Xcode/DerivedData/test-auxygswgvxhnqfamjqqncqxaieqk/Build/Intermediates/test.build/Debug-iphonesimulator/test.build/Objects-normal/x86_64/test.swiftmodule -framework Alamofire -Xlinker -sectcreate -Xlinker __TEXT -Xlinker __entitlements -Xlinker /Users/Dawid/Library/Developer/Xcode/DerivedData/test-auxygswgvxhnqfamjqqncqxaieqk/Build/Intermediates/test.build/Debug-iphonesimulator/test.build/test.app.xcent -framework Pods_test -Xlinker -dependency_info -Xlinker /Users/Dawid/Library/Developer/Xcode/DerivedData/test-auxygswgvxhnqfamjqqncqxaieqk/Build/Intermediates/test.build/Debug-iphonesimulator/test.build/Objects-normal/x86_64/test_dependency_info.dat -o /Users/Dawid/Library/Developer/Xcode/DerivedData/test-auxygswgvxhnqfamjqqncqxaieqk/Build/Products/Debug-iphonesimulator/test.app/test

ld: warning: directory not found for option '-F/Users/Dawid/Library/Developer/Xcode/DerivedData/test-auxygswgvxhnqfamjqqncqxaieqk/Build/Products/Debug-iphonesimulator/Alamofire'
ld: framework not found Alamofire
clang: error: linker command failed with exit code 1 (use -v to see invocation)

我尝试将框架搜索路径编辑为 $(inherited) ,清理项目,重新打开 Xcode,尝试新副本,下载以前版本的 Alamofire 以及基本上我在网上找到的所有内容,但到目前为止没有任何效果。

编辑:
添加了概述打印屏幕

编辑 2: 在@Jagdeep 建议之后,现在我有不同的错误(附有打印屏幕): enter image description here

project tree

最佳答案

尝试去你的

Target>Build Setting>Build Active Architecture Only

设置它

  • 调试

  • 发布

确保确保您有所有目标的相同配置 还有你的

Pods>Build Setting>Build Active Architecture Only

保持相同的值

清理和构建 希望有用

关于ios - ld : framework not found Alamofire,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42977862/

相关文章:

ios - 对嵌套的 NSMutableArray 进行排序

objective-c - 当用户更改值时启用“完成”按钮 - Xcode

iphone - Objective-C + RESTKit : Problems with getting Objects

ios - 在 iPhone 上安装 ipa

ios - 在 iOS 开发中,您可以拥有两个版本的 .nib 文件并使用各自的方案编译每个版本吗?

ios - 是否可以在 Xcode 7 中编译 Swift 2 代码并在 iOS 11.1 iPhone 6 上运行它?

iphone - iPad:标签栏项目标题不显示

ios - Podfile.lock没有这样的文件或目录

ios - 如何在 xcode 中打开现有的本地 pod?

xcode - 如何使有关 MobileCoreServices 和 AssetsLibrary 的 Xcode 11.4 警告静音?