28

I'm currently develop an swift SDK.

When compile the sample with the swift SDK, I got an error

dyld: Library not loaded: @rpath/MyDSK.framework/ODBlockChainWallet


Referenced from: /Users/{}/Sample.app/Sample



Reason: image not found

And if I go on the referenced folder, I can see the swift SDK T_T

Any idea?

odemolliens
  • 2,581
  • 2
  • 32
  • 34
  • Possible duplicate of [dyld: Library not loaded: @rpath/libswiftCore.dylib / Image not found](https://stackoverflow.com/questions/26104975/dyld-library-not-loaded-rpath-libswiftcore-dylib-image-not-found) – Cameron Lowell Palmer Mar 10 '18 at 08:44

4 Answers4

81

I was having this problem and was able to fix it by adding the Swift framework (MySDK.framework) to the "Embedded Binaries" section of the "General" tab of the Xcode project settings. Then deleting the derived data and rebuilding.

LOP_Luke
  • 3,150
  • 3
  • 22
  • 25
  • 1
    Although objective-C, worked for my custom framework in an example project. (might be useful for others) – StinkyCat Feb 05 '15 at 11:22
  • @LOP_Luke I have required library which is not loaded under PODs. and I have no idea how to add it under "Embedded Binaries". Anyone can help ? – Bonnke Jul 27 '15 at 19:17
  • @Bonnke Look at the left panel of Xcode and select your project file in the navigator. Then look at the center panel and look at the "Targets" section. Highlight your target (Probably the same name as your project) and make sure the "General" tab is selected. Then scroll down to the "Embedded Binaries section, you should see "Add embedded binaries here". Click the "+" button to add the framework. You also have to make sure the framework is in your workspace. You can do that by dragging it into the navigator on the left of the Xcode window. – LOP_Luke Jul 27 '15 at 20:28
  • @LOP_Luke I did steps you shared, but no way to add them from Pods... Not sure why. I can select them after I hit +, but it not appears there. I found the bug. Here is: http://stackoverflow.com/questions/31634407/incompatible-library-version-xxx-requires-version-2-0-0-or-later-but-runes-pro It is fixed, but still when I call that framework, it crashes. Thanks a lot – Bonnke Jul 27 '15 at 20:42
  • thanks a lot, worked like a charm. even without deleting the derived data. – tomi Aug 28 '15 at 07:12
2

Maybe you forgot to add the Copy Files Build Phase in your projects targets with "Framework" as destination

trandang
  • 23
  • 7
2

LOP_Luke's solution only half did it for me. After I added my embedded frameworks to the "Embedded Binaries" in the General tab, I had to go to "Build Settings" and check "Embedded Content Contains Swift Code" to YES. By default it is set to NO.

Followed by cleaning and building. Enjoy!

Nimrod Shai
  • 1,149
  • 13
  • 26
1

The following has worked for me:

  • "Embedded Content Contains Swift Code" to YES
  • Clean
  • Rebuild

(I suspect, although I cannot prove, that it's really the Clean that fixes this.)

Scott McKenzie
  • 16,052
  • 8
  • 45
  • 70