Dynamic Library Loading Issue: "Library not loaded" error when embedding Custom Framework within Another Custom Framework

I am encountering a dyld error (dyld[8942]: Library not loaded) when attempting to embed PaymentSampleFramework within POSSampleFramework, and only linking POSSampleFramework in the main application. The error is as follows:

  Referenced from: <99DE58BE-5611-3397-BED2-6D7DDCE5A878> /private/var/containers/Bundle/Application/B4CB8F71-F8A7-4A21-8C1B-170612C3C628/ParentApp.app/ParentApp
  Reason: tried: '/usr/lib/swift/PaymentSampleFramework.framework/PaymentSampleFramework' (no such file, not in dyld cache), '/private/preboot/Cryptexes/OS/usr/lib/swift/PaymentSampleFramework.framework/PaymentSampleFramework' (no such file), '/private/var/containers/Bundle/Application/B4CB8F71-F8A7-4A21-8C1B-170612C3C628/ParentApp.app/Frameworks/PaymentSampleFramework.framework/PaymentSampleFramework' (no such file), '/usr/lib/swift/PaymentSampleFramework.framework/PaymentSampleFramework' (no such file, not in dyld cache), '/private/preboot/Cryptexes/OS/usr/lib/swift/PaymentSampleFramework.framework/PaymentSampleFramework' (no such file), '/private/var/containers/Bundle/Application/B4CB8F71-F8A7-4A21-8C1B-170612C3C628/ParentApp.app/Frameworks/PaymentSampleFramework.framework/PaymentSampleFramework' (no such file)

The error occurs only when PaymentSampleFramework is not directly added to the application. I want to have only POSSampleFrameWork on the app side, with PaymentSampleFramework included within it.

I have shared the GitHub link to my workspace for reference: https://github.com/sarathdev/MyWorkSpace (Added PaymentSampleFramework inside application to avoid crash)

I'm seeking advice on whether it's possible to embed only POSSampleFrameWork without adding all internal dependencies. Any suggestions or solutions to resolve this issue would be greatly appreciated.

why Apple discourages creating an umbrella framework, is the umbrella setup is the only solution!

Answered by sarath_ios in 774391022

One potential solution is to make the internal libraries static. This would eliminate the need to include all internal dependencies on the application side. Are there any alternative solutions we should consider, and are there potential side effects to this approach?

Accepted Answer

One potential solution is to make the internal libraries static. This would eliminate the need to include all internal dependencies on the application side. Are there any alternative solutions we should consider, and are there potential side effects to this approach?

Dynamic Library Loading Issue: "Library not loaded" error when embedding Custom Framework within Another Custom Framework
 
 
Q