Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

dyld: Library not loaded with cocoapods 0.37 and Xcode 6.3

Tags:

I've been reading all the issues about the error:

dyld: Library not loaded: @rpath/Bolts.framework/Bolts Referenced from: /private/var/mobile/Containers/Bundle/Application/1542F906-CCE1-4181-AC7C-B5E3EE50E7D7/eBikeMotion.app/eBikeMotion Reason: no suitable image found. Did find:

Which makes my application unable to run in a real device (but it runs without any problem in the simulator. Until certain point I thought that it was an issue with the frameworks I was installing, but after installing manually the original one that was throwing the error, Alamofire, and the next Framework throwing the error was the next one in alphabetical order (Bolts, as you can see in the code snippet) So I've reached the conclusion that is indeed CocoaPods which is producing these errors. I've got the last version (0.37) with a clean install, Iv'e tried to create a new project, I've tried all the proposed solutions to this issue without any luck, so I have to open an issue, with the hope that someone can help me.

Regards.

like image 229
Jorge Revuelta Avatar asked May 05 '15 12:05

Jorge Revuelta


People also ask

What is Use_frameworks?

use_frameworks! declares that you want to use dynamic frameworks, instead of static libraries. With Xcode 9.0 and CocoaPods 1.5. 0 released, you could use static libraries with swift if you do not use use_frameworks! . One problem with use_frameworks! is that all your framework in Pods/Products are frameworks.


2 Answers

After reinstalling the whole system and don't finding a solution, I've found that some of the Build Phases mandatory for CocoaPods to run properly were missing.

The solution for this problem goes for the next steps:

  1. Deintegrate the cocoapods project (you can install the tool with sudo gem install cocoapods-deintegrate).

cocoapods-deintegrate on Github

  1. Modify your Podfile:

    You should define your target linking with link_with 'ProjectName'.

    You should define the target for your pods: target 'ProjectName' do [pods here] end.

  2. Make an install with pod install

  3. After doing this, go to XCode and check the following settings:

    Into project settings, under "Configurations" check that in Debug and Release you've got a Configuration set named Pods-ProjectName.[debug|release]

    Into your target, under "Build Phases" you should have three new phases that should be named: Check Pods Manifest, Embed Pods Frameworks and Copy Pods Resources.

  4. Make a clean, then build, then run into your device.

That's it.

like image 56
Jorge Revuelta Avatar answered Sep 30 '22 01:09

Jorge Revuelta


In my case, I followed the above answer by @Jorge, but it didn't resolve the problem. The exact error was a bit different because the missing file was @rpath Pods.framework/Pods. I finally resolved it with help from CocoaPods issue #3586:

Go to target > General > Linked Frameworks and Libraries section set both Pods.framework and Pods_target.framework to Optional.

Still trying to figure out exactly why.... this answer has some info: what-does-it-mean-to-weak-link-a-framework

like image 39
Suz Avatar answered Sep 30 '22 01:09

Suz