34

I'm using CocoaPods v0.36 with my Swift project and the following pods: Alamofire, CocoaLumberjack, SwiftyJSON.

Everything was fine till I used my Developer ID. Compiler started to have problems to compile the project, after some fixes and updates for CocoaPods my project compiles but at runtime I get the following error:

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

I read different posts related to this:

But none seems to solve the issue.

The only clue that I have is that the 3 frameworks are in red, so it seems that are not generated/linked.

enter image description here

Now, I've removed my Developer ID, but the issue is still there. Does anybody have an idea?

Sahil Kapoor
  • 11,183
  • 13
  • 64
  • 87
Ivan
  • 666
  • 1
  • 7
  • 17
  • How are you adding the frameworks to your project? If you know the location of them I would recommend that you try adding them manually. – l'L'l Apr 07 '15 at 06:27
  • Ivan, you're a lifesaver!…and can you post your solution as a full-fledged response? I spent hours trying other, useless solutions having intentionally skipped past this post since it's was labelled as having no solution. – clozach Jul 19 '15 at 01:09

15 Answers15

26

Solved Below the steps I did:

  • pod deintegrate, pod update, pod install
  • Reimported the three swift library files (generated by cocoapods)
  • Imported the three frameworks only in the Linked Frameworks and Libraries
  • Full clean and a build
Ivan
  • 666
  • 1
  • 7
  • 17
21

dyld library not loaded @rpath/framework

please make sure that the framework is showing under target->general->embeded binaries and linked framework and libraries section

if not then add by clicking + sign add just add the framework only

done!

NSurajit
  • 413
  • 4
  • 10
10

For iOS 13.3.1 : comment use_frameworks in podfile .

Rishabh Shukla
  • 461
  • 6
  • 19
  • 1
    Doesn't work for me... but this only happens on real device, simulator's fine... – Tieda Wei Feb 28 '20 at 23:33
  • @TiedaWei same was happening with me , try pod deintegrate and then pod clean and then again install your pods , this will remove your pofile and remove all pods so be careful on that :) – Rishabh Shukla Mar 01 '20 at 13:57
  • Thanks , it work. Comment and then pod install again. – iGhost Mar 18 '20 at 03:26
  • I notice when I comment `use_framework` in **podfile**, Xcode throw another error `...Proyect_Name.framework: 'No such file or directory'`. For resolve it, you need to do all yours pods as static libraries. Check [here](https://stackoverflow.com/a/60059840/7278926) for more details. Finally clean and build project and **pod install** – iGhost Mar 18 '20 at 18:40
6

we were running into this issue here at work and one person's project would run while the other would get this strange error.

We did some comparison and realized that error is being generated when in the Xcode project's target, under Build Phases its missing some of the run scripts that Cocoapods is supposed to generate.

Check your project to make sure that these 3 scripts are there

Check Pods Manifest.lock
 Embed Pods Frameworks
 Copy Pods Resources

If they aren't I've attached a screenshot of them so that you can add them manually

enter image description here enter image description here enter image description here

bolnad
  • 4,533
  • 3
  • 29
  • 41
5

Try this:

Find your Target --> Build Phases --> Add New Copy Files Phase -->Choose Destination Option,Frameworks --> Click add AFNetworking.framework --> ✓.

Vladyslav Panchenko
  • 1,517
  • 1
  • 19
  • 23
2

Solved by Unchecking Copy Only when installing. enter image description here

Atef
  • 2,872
  • 1
  • 36
  • 32
2

Make sure you have set valid certificate and provisioning profile in XCode!

Dhaval H. Nena
  • 3,992
  • 1
  • 37
  • 50
2

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.

Note: Free account is not worked in 13.3

Hitesh Surani
  • 12,733
  • 6
  • 54
  • 65
1

I solved that trouble just by uncheck the "copy only when installing" on copy frameworks in Build Phases

Qun Li
  • 1,256
  • 13
  • 13
1

After wasting two days and applying every solutions this worked for me. Hope it helps to you too.

Go to Keychain Access -> Certificates -> Double click on Apple Worldwide Developer Relations Certification Authority -> Click on the dropdown of trust -> When using this certificate -> set to Use System defaults

ssp009
  • 11
  • 1
0

None of the other stuff worked for me. So what did solve it for me in the end was a change in the podfile. I changed the code for the target in which it happened to:

target 'UITests' do
inherit! :search_paths
end

After a pod install it finally worked.

Drobs
  • 760
  • 8
  • 12
0

in iOS 13.3.1 you can't run your application in your apple device without paid developer account

you can read complete explanation in this link

complete explanation click here

0

I solved the problem in another way. The missing library was used inside of a framework that the application has a dependency on that. Also, In the Podfile the framework's pod target was outside of the application's target, so I moved the framework's target inside it like below:

target 'MyApplication' do
  use_frameworks!
  #blah blah 

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

  end
end

and then I ran the 'pod install' command and Boom! The crash was gone.

Behrad Kazemi
  • 302
  • 1
  • 10
0

After wasting full day i found the solution. I changed

pod 'Alamofire' or pod 'Alamofire', '~> 5.2'

to

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

And this worked for me.

Mandeep Singh
  • 857
  • 8
  • 13
0

First step: add use_frameworks! at the beginning of your podfile.

Second step: Add the bellow code at the end of your podfile. Which means after the end of your target.

dynamic_frameworks = ['Alamofire']
pre_install do |installer|
  installer.pod_targets.each do |pod|
    if !dynamic_frameworks.include?(pod.name)
      puts "Overriding the static_framework? method for #{pod.name}"
      def pod.static_framework?;
        true
      end
      def pod.build_type;
        Pod::BuildType.static_library
      end
    end
  end
end

Third step: run pod install

Mohammad Daihan
  • 538
  • 4
  • 15