1

I'm developing an iOS application which uses a separate SDK for some common business logic. That SDK is developed in another separate project which creates a dynamic binary framework as an output. The bundle type of that framework is a XCFramework as Apple suggested to use starting from Xcode 11. The content of this XCFramework is the following one:

MySDK.xcframework
├── Info.plist
├── ios-arm64
│   └── MySDK.framework
│   ├── Headers
│   │   ├── MySDK.h
│   │   ├── ...
│   ├── Info.plist
│   ├── Modules
│   │   └── module.modulemap
│   ├── MySDK
│   └── _CodeSignature
│   └── CodeResources
├── ios-x86_64-simulator
│   └── MySDK.framework
│   ├── Headers
│   │   ├── MySDK.h
│   │   ├── ...
│   ├── Info.plist
│   ├── Modules
│   │   └── module.modulemap
│   ├── MySDK
│   └── _CodeSignature
│   └── CodeResources
└── watchos-armv7k_arm64_32
    └── MySDK.framework
    ├── Headers
    │   ├── MySDK.h
    │   ├── ...
    ├── Info.plist
    ├── Modules
    │   └── module.modulemap
    ├── MySDK
    └── _CodeSignature
    └── CodeResources

If I use the XCFramework on the iOS target, everything works as expected and just importing the MySDK module I can use the SDK without any problem.

However, if I import the same framework on the Watch Extension target, and run it into a real iWatch it gives us the following error:

Details

Unable to install "Watch"
  Domain: com.apple.dt.MobileDeviceErrorDomain
  Code: -402620393
  --
  A signed resource has been added, modified, or deleted.
  Domain: com.apple.dt.MobileDeviceErrorDomain
  Code: -402620393
  User Info: {
    DVTRadarComponentKey = 364477;
    MobileDeviceErrorCode = "(0xE8008017)";
    "com.apple.dtdevicekit.stacktrace" = (
    0 DTDeviceKitBase 0x000000011ff4681a DTDKCreateNSErrorFromAMDErrorCode + 233
    1 DTDeviceKitBase 0x000000011ff87f70 __90-[DTDKMobileDeviceToken installApplicationBundleAtPath:withOptions:andError:withCallback:]_block_invoke + 155
    2 DVTFoundation 0x000000010697e385 DVTInvokeWithStrongOwnership + 73
    3 DTDeviceKitBase 0x000000011ff87ca8 -[DTDKMobileDeviceToken installApplicationBundleAtPath:withOptions:andError:withCallback:] + 1654
    4 IDEiOSSupportCore 0x000000011fdfee91 __118-[DVTiOSDevice(DVTiPhoneApplicationInstallation) processAppInstallSet:appUninstallSet:installOptions:completionBlock:]_block_invoke.352 + 4165
    5 DVTFoundation 0x0000000106ab1a10 __DVT_CALLING_CLIENT_BLOCK__ + 7
    6 DVTFoundation 0x0000000106ab3652 __DVTDispatchAsync_block_invoke + 1194
    7 libdispatch.dylib 0x00007fff729b6583 _dispatch_call_block_and_release + 12
    8 libdispatch.dylib 0x00007fff729b750e _dispatch_client_callout + 8
    9 libdispatch.dylib 0x00007fff729bcace _dispatch_lane_serial_drain + 597
    10 libdispatch.dylib 0x00007fff729bd452 _dispatch_lane_invoke + 363
    11 libdispatch.dylib 0x00007fff729c6a9e _dispatch_workloop_worker_thread + 598
    12 libsystem_pthread.dylib 0x00007fff72c116fc _pthread_wqthread + 290
    13 libsystem_pthread.dylib 0x00007fff72c10827 start_wqthread + 15
  );
}

--

System Information

macOS Version 10.15.3 (Build 19D76)
Xcode 11.4 (16134)

The SDK target is compiled for the watchOS architecture as you guys can see the corresponding folder within its contents (watchos-armv7k_arm64_32). Also, I've ensured it was correctly compiled using the LIPO tool.

What I have tried:

  • Follow related issues here, here and here without any success.
  • Duplicate the XCFramework with only watchos architecture and include both frameworks in the project but targeting different destinations. It does not work either.
  • Try all framework embedding options: Embed & sign or Embed without signing. It gives the error shown above.

I'm a bit lost and I don't know what else I could try. Anyone who could shed some light on this would be very appreciated.

GoRoS
  • 4,445
  • 2
  • 37
  • 57

1 Answers1

1

I workarounded the same issue building custom framework with staticlib Mach-O Type:

  1. Open Project Settings of your custom framework (MySDK, for example).
  2. Choose target for watchOS.
  3. Find Mach-O Type and set it to Static Library. Mach-O Type: Static Library
  4. Build frameworks and xcframework.

Now you can link your application with MySDK.xcframework. Do not embed xcframework for watchOS target in the application - it should be linked statically.