"No code signature found" when using SPM to integrate binary .xcframework (only on the device)

Hi,
I've tried integrating a binary framework (distributed as xcframework) inside an SPM package. Everything works fine on the simulator but fails once I try to run it on the device with No code signature found error.

This is a reproducible project:

The package is structured as below:

// swift-tools-version:5.7
import PackageDescription

let package = Package(
    name: "DistilProtection",
    platforms: [
        .iOS(.v13)
    ],
    products: [
        .library(
            name: "DistilProtection",
            type: .dynamic,
            targets: ["DistilProtection", "distil_protection"])
    ],
    dependencies: [

    ],
    targets: [
        .binaryTarget(
            name: "distil_protection",
            path: "distil_protection.xcframework"
        ),
        .target(
            name: "DistilProtection",
            dependencies: [
                "distil_protection"
            ]
        ),
    ]
)

And this is the detailed error I received from Xcode.

System Information

macOS Version 13.0.1 (Build 22A400)
Xcode 14.1 (21534.1) (Build 14B47b)
Timestamp: 2022-12-01T10:52:31+01:00

Details

Unable to install "TestProject"
Domain: com.apple.dt.MobileDeviceErrorDomain
Code: -402620388
User Info: {
    DVTErrorCreationDateKey = "2022-12-01 09:52:31 +0000";
    IDERunOperationFailingWorker = IDEInstalliPhoneLauncher;
}
--
No code signature found.
Domain: com.apple.dt.MobileDeviceErrorDomain
Code: -402620388
User Info: {
    DVTRadarComponentKey = 364477;
    MobileDeviceErrorCode = "(0xE800801C)";
    "com.apple.dtdevicekit.stacktrace" = (
	0   DTDeviceKitBase                     0x00000001108fc2bc DTDKCreateNSErrorFromAMDErrorCode + 300
	1   DTDeviceKitBase                     0x00000001109303c0 __90-[DTDKMobileDeviceToken installApplicationBundleAtPath:withOptions:andError:withCallback:]_block_invoke + 136
	2   DVTFoundation                       0x0000000101a05ec8 DVTInvokeWithStrongOwnership + 76
	3   DTDeviceKitBase                     0x0000000110930144 -[DTDKMobileDeviceToken installApplicationBundleAtPath:withOptions:andError:withCallback:] + 1196
	4   IDEiOSSupportCore                   0x000000010ae47c08 __118-[DVTiOSDevice(DVTiPhoneApplicationInstallation) processAppInstallSet:appUninstallSet:installOptions:completionBlock:]_block_invoke.147 + 2328
	5   DVTFoundation                       0x0000000101b10784 __DVT_CALLING_CLIENT_BLOCK__ + 16
	6   DVTFoundation                       0x0000000101b111f0 __DVTDispatchAsync_block_invoke + 152
	7   libdispatch.dylib                   0x00000001afec19dc _dispatch_call_block_and_release + 32
	8   libdispatch.dylib                   0x00000001afec3504 _dispatch_client_callout + 20
	9   libdispatch.dylib                   0x00000001afecabbc _dispatch_lane_serial_drain + 672
	10  libdispatch.dylib                   0x00000001afecb708 _dispatch_lane_invoke + 384
	11  libdispatch.dylib                   0x00000001afed634c _dispatch_workloop_worker_thread + 652
	12  libsystem_pthread.dylib             0x00000001b0046100 _pthread_wqthread + 288
	13  libsystem_pthread.dylib             0x00000001b0044e20 start_wqthread + 8
);
}
--

Analytics Event: com.apple.dt.IDERunOperationWorkerFinished : {
    "device_model" = "iPhone13,3";
    "device_osBuild" = "16.1.2 (20B110)";
    "device_platform" = "com.apple.platform.iphoneos";
    "launchSession_schemeCommand" = Run;
    "launchSession_state" = 1;
    "launchSession_targetArch" = arm64;
    "operation_duration_ms" = 1120;
    "operation_errorCode" = "-402620388";
    "operation_errorDomain" = "com.apple.dt.MobileDeviceErrorDomain";
    "operation_errorWorker" = IDEInstalliPhoneLauncher;
    "operation_name" = IDEiPhoneRunOperationWorkerGroup;
    "param_consoleMode" = 0;
    "param_debugger_attachToExtensions" = 0;
    "param_debugger_attachToXPC" = 1;
    "param_debugger_type" = 5;
    "param_destination_isProxy" = 0;
    "param_destination_platform" = "com.apple.platform.iphoneos";
    "param_diag_MainThreadChecker_stopOnIssue" = 0;
    "param_diag_MallocStackLogging_enableDuringAttach" = 0;
    "param_diag_MallocStackLogging_enableForXPC" = 1;
    "param_diag_allowLocationSimulation" = 1;
    "param_diag_checker_tpc_enable" = 1;
    "param_diag_gpu_frameCapture_enable" = 0;
    "param_diag_gpu_shaderValidation_enable" = 0;
    "param_diag_gpu_validation_enable" = 0;
    "param_diag_memoryGraphOnResourceException" = 0;
    "param_diag_queueDebugging_enable" = 1;
    "param_diag_runtimeProfile_generate" = 0;
    "param_diag_sanitizer_asan_enable" = 0;
    "param_diag_sanitizer_tsan_enable" = 0;
    "param_diag_sanitizer_tsan_stopOnIssue" = 0;
    "param_diag_sanitizer_ubsan_stopOnIssue" = 0;
    "param_diag_showNonLocalizedStrings" = 0;
    "param_diag_viewDebugging_enabled" = 1;
    "param_diag_viewDebugging_insertDylibOnLaunch" = 1;
    "param_install_style" = 0;
    "param_launcher_UID" = 2;
    "param_launcher_allowDeviceSensorReplayData" = 0;
    "param_launcher_kind" = 0;
    "param_launcher_style" = 0;
    "param_launcher_substyle" = 0;
    "param_runnable_appExtensionHostRunMode" = 0;
    "param_runnable_productType" = "com.apple.product-type.application";
    "param_runnable_type" = 2;
    "param_testing_launchedForTesting" = 0;
    "param_testing_suppressSimulatorApp" = 0;
    "param_testing_usingCLI" = 0;
    "sdk_canonicalName" = "iphoneos16.1";
    "sdk_osVersion" = "16.1";
    "sdk_variant" = iphoneos;
}
--

In fact, I'm not sure it's about SPM. I can reproduce the same problem even with a simple direct import without Xcode. Same signature error.

I've also created a RADAR for this FB11860546

We can close this issue since it was an error of the framework vendor.
Thanks and sorry for the inconvenience.

I'm quit interested what was wrong in the structure, thanks!