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

后端 未结 8 1743
太阳男子
太阳男子 2020-12-02 23:43

I\'ve built a Swift framework and now I\'m trying to start building a Swift iOS application that will use that framework. I\'m getting this error:

dyld: Libr         


        
相关标签:
8条回答
  • 2020-12-02 23:48

    You can solve this by setting "Always Embed Swift Standard Libraries" to "Yes" in the Build Settings of your target.

    0 讨论(0)
  • 2020-12-02 23:49

    How are you installing your dependencies?

    I had a similar issue:

    dyld: Library not loaded: @rpath/libswiftSwiftOnoneSupport.dylib Referenced from: <internal framework> Reason: image not found

    It turned out to be related to Swift whole-module optimization.

    Using Carthage as a dependency manager, they were being compiled for Release, and thus compiled with whole-module optimization, which Xcode suggested I turn on. Running the app on the simulator compiles it for Debug. I'm guessing that dynamic frameworks cannot be at a different level of optimization from the app running it.

    The solution was to explicitly specify the configuration I wanted Carthage to build for. (carthage bootstrap --configuration Debug) Oh, and cleaning my build folder, of course.

    0 讨论(0)
  • 2020-12-02 23:52

    After several days of being stuck with this issue I finally found something that worked for me; hopefully this will help others too.

    Turns out that specifically using print() anywhere in the code will somehow force libswiftSwiftOnoneSupport.dylib to be loaded and the issue will go away.

    I'm using Xcode 10.1, Swift 4.2 and the pod that was giving me this issue was Nimble.

    BTW, I am aware of @S2dent's suggestion to "just add some code" but in my case my framework already had several different classes so it didn't help me.

    0 讨论(0)
  • 2020-12-02 23:54

    I had the same issue, adding the library (my own build one) to Linked Frameworks and Libraries in General tab of the app solved the issue.

    0 讨论(0)
  • 2020-12-03 00:01

    It is an dynamic linker error which links binary in load or runtime

    [@rpath]

    0 讨论(0)
  • 2020-12-03 00:06

    You can also provide an Host Application to your test target if you don't want to add Foundation.framework to Linked Frameworks or Embedded Binaries

    0 讨论(0)
提交回复
热议问题