Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode11 dyld: Library not loaded ... Reason: image not found

Tags:

ios

swift

xcode11

I am using Xcode11

I am getting following error, when I try to use a framework in a SampleAppSwift project:

dyld: Library not loaded: @rpath/VoiceSampler.framework/VoiceSampler

Referenced from: /private/var/containers/Bundle/Application/7ECB8715–2964–47B6–9F75–056F32846019/SampleAppSwift.app/SampleAppSwift

Reason: image not found

In the SampleAppSwift project, under Build Settings, I tried setting 'Always Embed Swift Standard Libraries' to YES. That did not help.

like image 710
Bharat Biswal Avatar asked Sep 28 '19 07:09

Bharat Biswal


3 Answers

enter image description here

General->Frameworks, Library, and Embedded Content. If it's "Do Not Embed", change to "Embed Without Signing".

like image 179
rocky Avatar answered Nov 02 '22 10:11

rocky


I had same problem. You should add a Copy File phase in your Build Phases as follows:

Under Build Phases, click on + icon to add new phase, and select New Copy Files Phase.

Drag the newly created Copy Files phase above Compile Sources phase

In the new Copy Files phase, select Frameworks for Destination drop down.

Leave subpath blank. Let be default Copy only when installing.

Under the table, click '+' and then select your Framework, i.e. VoiceSampler.framework

Make sure Code Sign on Copy is checked (ticked).

Do a clean build.

like image 41
Kumari Shalini Avatar answered Nov 02 '22 08:11

Kumari Shalini


There is another simpler solution which worked for me if you are using Cocoapods.

In your Podfile, add use_frameworks! after your Target line like this -

target 'YourAppName' do
  use_frameworks!

Basically it adds all your pods as a framework in your framework folder.

like image 2
mAc Avatar answered Nov 02 '22 10:11

mAc