Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Swift dyld: Library not loaded - using 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!

like image 685
ded Avatar asked Jul 31 '15 20:07

ded


2 Answers

I see you're also getting a warning. Is the warning something like this?

ld: warning: -weak_framework is treated as -framework when used with -bitcode_bundle (Xcode setting ENABLE_BITCODE=YES). Weak linking may still happen based on availability mark-up in headers

If so you should try to keep the framework weak linked and disable bitcode..

Found this screenshot here.

If that doesn't work try disabling anything else you didn't compile with. Checking for pods update etc.

like image 96
Edison Avatar answered Nov 15 '22 05:11

Edison


It is a known cocoa pods issue. See https://github.com/CocoaPods/CocoaPods/issues/3903

You can either downgrade cocoa pods. Or using the methods mentioned the that post: delete "Compatibility version" completely, leave it empty. A simple script can be added to Podfile to automate this:

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

Then clean your project and run pod install.

like image 20
JDG Avatar answered Nov 15 '22 04:11

JDG