CoreDeviceError: Keyboard Extension cannot debug on real device

I have a keyboard extension which depends on Bluetooth so I have to debug it on a real device (iOS 17.3) with Xcode 15.2. When I install the containing app on the real iPad it works fine. However, when I try to debug the keyboard on the iPad by selecting it as the target instead of the containing app and clicking run I get the below error. I have no issues on the simulator except I can’t run bluetooth.

I have tried steps here: https://developer.apple.com/forums/thread/730947 and various other restart, reinstall etc. I've updated and re-paired as described at: https://stackoverflow.com/questions/77374179/xcode-15-ios-17-error-failed-to-install-the-app-on-the-device

Failed to install the app on the device. Domain: com.apple.dt.CoreDeviceError Code: 3002 Failure Reason: The provided item to be installed is not of a type that CoreDevice recognizes. User Info: { IDERunOperationFailingWorker = IDEInstallCoreDeviceWorker; }

Event Metadata: com.apple.dt.IDERunOperationWorkerFinished : { "device_isCoreDevice" = 1; "device_model" = "iPad12,1"; "device_osBuild" = "17.3 (21D50)"; "device_platform" = "com.apple.platform.iphoneos"; "dvt_coredevice_version" = "355.7.7"; "dvt_mobiledevice_version" = "1643.60.2"; "launchSession_schemeCommand" = Run; "launchSession_state" = 1; "launchSession_targetArch" = arm64; "operation_duration_ms" = 21; "operation_errorCode" = 3002; "operation_errorDomain" = "com.apple.dt.CoreDeviceError"; "operation_errorWorker" = IDEInstallCoreDeviceWorker; "operation_name" = IDERunOperationWorkerGroup; "param_debugger_attachToExtensions" = 0; "param_debugger_attachToXPC" = 1; "param_debugger_type" = 1; "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" = 8194; "param_runnable_appExtensionHostRunMode" = 0; "param_runnable_productType" = "com.apple.product-type.app-extension"; "param_structuredConsoleMode" = 1; "param_testing_launchedForTesting" = 0; "param_testing_suppressSimulatorApp" = 0; "param_testing_usingCLI" = 0; "sdk_canonicalName" = "iphoneos17.2"; "sdk_osVersion" = "17.2"; "sdk_variant" = iphoneos; }

UPDATE:

  • Containing the keyboard extension in a new simple app without any Frameworks and Libraries does not have any issues. I can debug the outer app or the Keyboard Extension easily from Xcode.

  • The above issue only happens when the outer app is a Flutter app with a dependency on pods_runner.

  • I've figured out that I can install the outer app and then manually attach the debugger to the keyboard process. This is an adequate workaround but sucks to not be able to debug early lifecycle methods on launch.

This all seems to suggest that it's not some sort of cocoapods headache but rather some sort of mishap related to how Xcode launches Extensions for debugging specifically when the outer app depends on some framework or other complexity.

CoreDeviceError: Keyboard Extension cannot debug on real device
 
 
Q