Code signing issue with SPM Dynamic Library

I have a framework (MyFramework) in which I want to use an existing dynamic framework via SPM (called now MyDynamicFramework).

I included it as a package dependency and all seems to be good:

Then, I created a test application in which I simply include my framework with Enbed & Sign.

When I run this test application, it all works fine in simulator, but in real device I get the following signing-related issue:

dyld[24248]: Library not loaded: @rpath/MyDynamicFramework.framework/MyDynamicFramework
  Referenced from: <ED356026-4AD8-3AD4-9CD7-BE977EE551E4> /private/var/containers/Bundle/Application/432B2A6D-55A7-4C9D-8EA2-622B81E215EA/MyFrameworkTestApp.app/Frameworks/MyFramework.framework/MyFramework
  Reason: tried: '/private/var/containers/Bundle/Application/432B2A6D-55A7-4C9D-8EA2-622B81E215EA/MyFrameworkTestApp.app/Frameworks/MyDynamicFramework.framework/MyDynamicFramework' (no such file),
'/private/var/containers/Bundle/Application/432B2A6D-55A7-4C9D-8EA2-622B81E215EA/MyFrameworkTestApp.app/Frameworks/MyFramework.framework/Frameworks/MyDynamicFramework.framework/MyDynamicFramework' (code signature in <2BD920A5-1906-31B6-99B9-18DE47F02514>
'/private/var/containers/Bundle/Application/432B2A6D-55A7-4C9D-8EA2-622B81E215EA/MyFrameworkTestApp.app/Frameworks/MyFramework.framework/Frameworks/MyDynamicFramework.framework/MyDynamicFramework' not valid for use in process: mapped file has no cdhash, completely unsigned? Code has to be at least ad-hoc signed.),
'/Users/XXXXXXX/Library/Developer/Xcode/DerivedData/MyFramework-gedzmltwlpgatndvsrwkinsfgwhr/Build/Products/Debug-iphoneos/PackageFrameworks/MyDynamicFramework.framework/MyDynamicFramework' (no such file),
...

Am I missing some settings? I thought that Embed & Sign should have solved the issue but it didn't. Thanks.

It seems that it works if I embed the MyDynamicFramework in my test application as well, even thought that's already embedded into the framework (MyFramework) that I'm using. I don't see why should I do that, isn't that including the same dynamic framework twice?

Code signing issue with SPM Dynamic Library
 
 
Q