Swift dyld: Library not loaded - using CocoaPods

时间:2015-07-31 20:41:04

标签: ios iphone xcode swift cocoapods

I apologize for what may seem like an overly asked question, but no matter how many answers to related questions I'm asking, none of them seem to work. See (in order) here, here, here, and here.

I'm running Xcode 6.4 with iOS 8 (iPhone only), using CocoaPods. Many of other answers provided, there seems to be a build setting, or general setting that does not exist in my version of Xcode, yielding many conclusions not helpful.

As a matter of reference, I followed This CocoaPods Tutorial which worked with ease. But it's only when I attempt to load the app onto my phone (yes, I have valid certificates, and my other apps work just fine without using other dependencies), the app immediately crashes just as it's about to load.

dyld: Library not loaded: @rpath/Pods_ExamplePods.framework/Pods_ExamplePods
Referenced from: /private/var/mobile/Containers/Bundle/Application/F109A377-3EA4-48C2-9042-CB6C384C9F30/ExamplePods.app/ExamplePods
Reason: image not found
(lldb) 

See here where I named my app "ExamplePods"

enter image description here

And then here is my Folder Structure, opened in Workspace mode. Note that there's only 3 dependencies.

enter image description here

Then see "General Settings" and "Build Settings"

enter image description here

enter image description here

I'm at a complete loss, help is much appreciated!

4 个答案:

答案 0 :(得分:2)

我看到你也在收到警告。警告是这样的吗?

  

ld:警告:-weak_framework在与-bitcode_bundle(Xcode设置ENABLE_BITCODE = YES)一起使用时被视为-framework。根据标题中的可用性标记

,仍可能发生弱链接

如果是这样,你应该尝试保持框架弱链接并禁用bitcode ..

在此处找到此屏幕截图。

如果这不起作用,请尝试禁用您未编译的任何其他内容。检查pods更新等。

答案 1 :(得分:0)

这是一个已知的可可豆荚问题。见https://github.com/CocoaPods/CocoaPods/issues/3903

你可以降级可可豆荚。或者使用该帖子中提到的方法:完全删除“兼容性版本”,​​将其留空。 可以将一个简单的脚本添加到Podfile中以自动执行此操作:

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
        config.build_settings['DYLIB_COMPATIBILITY_VERSION'] = ''
    end
  end
end

然后清理项目并运行pod install。

答案 2 :(得分:0)

我有同样的问题。就我而言,我嵌入了框架,还使用了CocoaPods。

以下步骤可为我修复此问题:

  1. 转到目标的构建阶段
  2. 将“嵌入框架”阶段移至“ [CP]嵌入式Pod框架”阶段和“ [CP]复制Pod资源”阶段下。

希望它可以帮助遇到此问题的其他人。

答案 3 :(得分:-1)

我有同样的问题,以下解决方案解决了它。

在链接的框架和库中(在构建阶段),将Pods.framework标记为Optional而不是required。