dyld:未加载库:@rpath/Alamofire.framework/Versions/A/Alamofire 原因:找不到图像

dyld: Library not loaded: @rpath/Alamofire.framework/Versions/A/Alamofire Reason: image not found

我将 CocoaPods v0.36 与我的 Swift 项目和以下 pods 一起使用:AlamofireCocoaLumberjackSwiftyJSON

在我使用我的开发者 ID 之前一切都很好。 在对 CocoaPods 进行一些修复和更新后,编译器开始出现编译项目的问题,我的项目编译但在运行时出现以下错误:

dyld: Library not loaded: @rpath/Alamofire.framework/Versions/A/Alamofire   
Referenced from: /Users/Ivan/Library/Developer/Xcode/DerivedData/myApp-bsxfcnwqpaxnzbhencwzteasshzf/Build/Products/Debug/myApp.app/Contents/MacOS/myApp  
Reason: image not found

我阅读了与此相关的不同帖子:

但是 none 似乎可以解决问题。

我唯一的线索是这 3 个框架是红色的,所以看起来不是 generated/linked。

现在,我已经删除了我的 Developer ID,但问题仍然存在。 有人有想法吗?

我们在工作中 运行 遇到了这个问题,一个人的项目会 运行 而另一个人会得到这个奇怪的错误。

我们做了一些比较,发现在 Xcode 项目的目标中会产生错误,在 Build Phases 下它缺少一些 Cocoapods 应该生成的 运行 脚本.

检查您的项目以确保存在这 3 个脚本

Check Pods Manifest.lock
 Embed Pods Frameworks
 Copy Pods Resources

如果不是,我附上了它们的屏幕截图,以便您可以手动添加它们

dyld 库未加载@rpath/framework

请确保框架显示 在 target->general->embedded binaries and linked framework and libraries 部分

如果没有则通过单击 + 号添加仅添加框架

完成!

我通过在构建阶段

中取消选中复制框架上的 "copy only when installing" 解决了这个问题

按照我的步骤解决了:

  • pod 分解、pod 更新、pod 安装
  • 重新导入了三个 swift 库文件(由 cocoapods 生成)
  • 仅在 Linked Frameworks and Libraries 中导入了三个框架
  • 完全清理并构建

通过在安装时取消选中仅复制解决。

确保您已在 XCode 中设置 有效证书 和配置文件!

None 其他东西对我有用。所以最终为我解决的是 podfile 的更改。我更改了它发生的目标的代码:

target 'UITests' do
inherit! :search_paths
end

pod install 后终于成功了。

试试这个:

找到你的Target --> Build Phases --> Add New Copy Files Phase -->Choose Destination Option,Frameworks --> 点击add AFNetworking.framework --> ✓.

在浪费了两天时间并应用了所有对我有用的解决方案之后。希望对你也有帮助。

转到 Keychain Access -> Certificates -> 双击 Apple Worldwide Developer Relations Certification Authority -> 点击信任下拉菜单 -> When using this certificate -> set to Use System defaults

对于 iOS 13.3.1:在 podfile 中评论 use_frameworks。

在 iOS 13.3.1 中,如果没有付费开发者帐户,您将无法 运行 在您的苹果设备中使用您的应用程序

您可以在 link

中阅读完整的解释

complete explanation click here

I have tried all the above solutions but no luck.

For me, Just run your app using an enrolled account instead of a free apple account.

注意:免费帐户在 13.3 中不可用

我用另一种方式解决了这个问题。 缺少的库是在应用程序依赖于它的框架内使用的。 此外,在 Podfile 中,框架的 pod 目标在应用程序的目标之外,因此我将框架的目标移入其中,如下所示:

target 'MyApplication' do
  use_frameworks!
  #blah blah 

  target 'MyFramework' do
    use_frameworks!
    pod 'The crashing library'
    #more blah blah

  end
end

然后我 运行 'pod install' 命令和 Boom!崩溃消失了。

在浪费了一整天之后,我找到了解决方案。 我变了

pod 'Alamofire' 或 pod 'Alamofire', '~> 5.2'

pod 'Alamofire', '~> 5.0.0-rc.3'

这对我有用。