Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

dyld: Library not loaded: @rpath/libswiftContacts.dylib

Tags:

xcode

swift

dyld: Library not loaded: @rpath/libswift_stdlib_core.dylib

dyld: Library not loaded: @rpath/libswiftCore.dylib. Issue persist

I know that theses question have been answered several times, but "dyld: Library not loaded: @rpath/libswiftContacts.dylib" I have not been able to find a proper solution to this error when I am coding a Swift application for XCode 7.2:

Here I use Contact & ContactUI Frameworks:: @rpath/libswiftContacts.dylib

dyld: Library not loaded: @rpath/libswiftContacts.dylib
Referenced from: /var/mobile/Containers/Bundle/Application/C0F2B5CB-628C-4643-9473-648D3099D8FB/HomeMadeFood_User.app/HomeMadeFood_User
 Reason: image not found

I have tried all these actions:

  • Restarting Xcode, iPhone, computer
  • Cleaning & rebuilding
  • Revoking and creating new certificate/provision profile
  • Runpath Search Paths is '$(inherited) @executable_path/Frameworks'
  • Embedded Content Contains Swift Code is 'Yes'
  • Code Signing Identity is developer
  • deleting Xcode's Derived Data directory.

    but I have always got the same error... enter image description here enter image description here enter image description here

I tried like this: but i am getting an error like:

/Users/mac-jarc/Library/Developer/Xcode/DerivedData/HomeMadeFood_User-bmwdevsopruaqxfrbibhaspidobn/Build/Products/Debug-    iphoneos/HomeMadeFood_User.app/Frameworks/Contacts.framework: bundle format unrecognized, invalid, or unsuitable
Command /usr/bin/codesign failed with exit code 1

enter image description here

like image 827
Mannam Brahmam Avatar asked Jan 25 '16 06:01

Mannam Brahmam


2 Answers

I had this same error for a couple of weeks:

dyld: Library not loaded: @rpath/libswiftContacts.dylib

Basically I was able to run and test my app on device. Then about 2 weeks ago, I wasn't able to run the tests on device anymore. Tests were running fine on simulator. I can't think what changed. The error I saw was the one above. I searched Google for ages trying to find a solution, and tried many fixes unsuccessfully. The fix that finally worked was to delete the Derived Data. Once I did this, I was once again able to run the tests on my device.

Fix that worked for me:

  1. Go to Xcode > Preferences > Locations > Derived Data (click on little arrow to open up the folder in finder) e.g. /Users/[username]/Library/Developer/Xcode/DerivedData

  2. Delete the entire DerivedData folder

  3. Clean/Build

  4. Test on device - finally works again

like image 118
Aliya Aziz Avatar answered Oct 26 '22 18:10

Aliya Aziz


In our case, it was clear that there was a bug in the way Xcode was resolving dependencies to our target.

Let's me start by saying, the solution was:

import PassKit

Now, before you raise that eyebrow, here is why this worked:

  1. We relied on a Swift framework that imports PassKit
  2. We distributed the prebuilt binary to team members
  3. The team observed the crash, just as OP mentioned it
  4. Adding that import in the app target made Xcode embed the required swift libraries

Note: Just linking PassKit in the GUI did absolutely nothing.

like image 27
Mazyod Avatar answered Oct 26 '22 19:10

Mazyod