How to embed dylib into iOS app

I have a project which consist of three elements:

  1. C source code that is compiled to .dylib
  2. Swift framework used to provide user-friendly swift API for .dylib
  3. iOS app consuming both .dylib and swift proxy


I have added both swift proxy and .dylib as "Framework and libraries" dependency to iOS app project. Things work as expected on my iPhone. However when I attemt to send my app to Apple Store Connect I get following error:


ITMS-90429: Invalid Swift Support - The files libswiftDarwin.dylib, libswiftDispatch.dylib, libswiftCoreGraphics.dylib, libswiftCoreFoundation.dylib, libswiftCore.dylib, libswiftFoundation.dylib, libswiftObjectiveC.dylib aren’t at the expected location /Payload/Runner.app/Frameworks. Move the file to the expected location, rebuild your app using the current public (GM) version of Xcode, and resubmit it.


I figured this can be caused by .dylib file being embedded directly in iOS app, so I tried to embed .dylib into swift framework. Then I made iOS app embedding only swift framework, which consist of .dylib file. However I am getting following error in this configuration:


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

Referenced from: /private/var/containers/Bundle/Application/.../swiftProxy.framework/swiftProxy

Reason: no suitable image found. Did find:

/private/var/containers/Bundle/Application/.../swiftProxy.framework/Frameworks/libX.dylib: code signature in (/private/var/containers/Bundle/Application/.../swiftProxy.framework/Frameworks/libX.dylib) not valid for use in process using Library Validation: mapped file has no cdhash, completely unsigned? Code has to be at least ad-hoc signed.


This does not make sense for me, but I figured this is not the way.


So the question is: how do I embed dylib so that it can be put on Apple Store Connect and then on Testflight?


Thank you 🙂

Have you got any solution for this? Am also facing similar issues.

How to embed dylib into iOS app
 
 
Q