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

I eventually got this working using a mix of fixes. I'm not sure if all of them are needed, but I'm documenting what seemed to work for me here, just in case anyone else can benefit by what I've found.

  1. I have set Always Embed Swift Standard Libraries to a value of YES in the build settings tab for both my Swift framework and in the Swift application that uses the framework.
  2. I have added Foundation.framework to the Linked Frameworks and Libraries section of the general tab for both my Swift framework and in the Swift application that uses the framework.
  3. I have added Foundation.framework to the Embedded Binaries section of the general tab for the Swift application that uses the framework.

With all 3 of these settings in place, I am able to build and run my application without encountering this error.


This might not be the case for everyone, but I solved it by actually writing some code in the main target.

I had an empty project consisting of a framework and a test target, and when running tests I was getting this error. Apparently Swift is pretty smart to detect that you don't actually need this library and does not link to libswiftSwiftOnoneSupport.dylib.

The fix is just to add some code, I just added:

class Test {
    func a() { print ("something") }
}

and libswiftSwiftOnoneSupport.dylib got linked.

Tags:

Ios

Xcode

Swift