1

I have a swift framework integrated with my project and it works fine on a real device no problem at all.

But when I try to run the the same project on simulator then I am getting the issue.

dyld: Library not loaded: @rpath/libswiftCore.dylib
Referenced from: /Users/Shankar/Library/Developer/CoreSimulator/Devices/78BF3C2C-ECD8-408E-8CBD-2306AE4B2351/data/Containers/Bundle/Application/B28FB671-F67D-4927-8E55-AFB569B44222/Mytest.app/Frameworks/SKDarwin.framework/SKDarwin
Reason: image not found

I tried the solutions available on stackoverflow that were suggested for this error but none fixes the issue.

It could be because the error happens only on simulator.

Any suggestions to fix the problem is appreciated

Note:

This is not duplicate of the questions that were already asked in #SO please read the question details to know how its different from all those.

This question is defintey different as it only happens on simulator and non of the solution that has been mentioned works.

Shankar Naik
  • 401
  • 5
  • 16
  • Possible duplicate of [dyld: Library not loaded: @rpath/libswiftCore.dylib](https://stackoverflow.com/questions/26024100/dyld-library-not-loaded-rpath-libswiftcore-dylib) – Abhay Koradiya Jul 05 '18 at 12:14

3 Answers3

2

For me none of the previous solutions worked. We discovered that there is an flag ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES (in earlier versions: "Embedded Content Contains Swift Code") in the Build Settings that needs to be set to YES. It was NO by default!

1

After pulling off my brain for almost 2 days i finally figured out the solution. All you need to do is set the third party frameworks you are using in your custom framework for e.g:- socket.io-client-swift as Optional instead of Required under Link binary with Libraries in build Phases section. That's all. try it again and it will run as expected.

sanyam jain
  • 192
  • 1
  • 3
  • 13
0

I think you are creating your own Framework and using that one.

Problem:

When you are building a Framework that time you are running your Framework on Real Device not simulator and after that, you are importing that Framework into your project.

It will run Only on Real Device because you are created Framework only for Real device not for Simulator

If you run your Framework on simulator so it will work only on Simulator. not Real Device.

Solution:

Create A pod for Your Framwork It will run on both.(Real Device & Simulator)

Anup Gupta
  • 1,993
  • 2
  • 25
  • 40