Search code examples
iosswiftxcode11

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


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.


Solution

  • 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.