Unable to Install app when adding target extension to support WidgetKit
Describe the bug
So I wanted to add Widgets to my app, and did so using widgetKit extension. Everything worked fine. But now I wanted to add support for this in my Project.yml, so I modified my Project.yml and added the code. Everything goes fine, until the installation part.
Here's a part of my Project.yml to reproduce the issue.
targets:
DemoApp:
#some code
dependencies:
- target: DemoWIdgetsExtension
#some code
DemoWIdgetsExtension:
type: app-extension
subtype: widgetkit-extension
platform: iOS
deploymentTarget: 14.0
settings:
base:
INFOPLIST_FILE: DemoWIdgets/Info.plist
DEVELOPMENT_TEAM: xxxxxxxx
SKIP_INSTALL: true
PRODUCT_NAME: $(TARGET_NAME)
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME: AccentColor
ASSETCATALOG_COMPILER_WIDGET_BACKGROUND_COLOR_NAME: WidgetBackground
CODE_SIGN_STYLE: Automatic
CODE_SIGN_ENTITLEMENTS: AppWidget/AppWidget.entitlements
sources:
- DemoWIdgets
dependencies:
- sdk: SwiftUI.framework
- sdk: WidgetKit.framework
Unable to install "DemoApp"
Domain: com.apple.dt.MobileDeviceErrorDomain
Code: -402653081
Recovery Suggestion: Please check your project settings and ensure that a valid product has been built.
User Info: {
DVTErrorCreationDateKey = "2023-02-10 16:30:34 +0000";
IDERunOperationFailingWorker = IDEInstalliPhoneLauncher;
}
--
There was an internal API error.
Domain: com.apple.dt.MobileDeviceErrorDomain
Code: -402653081
User Info: {
DVTRadarComponentKey = 261622;
MobileDeviceErrorCode = "(0xE8000067)";
"com.apple.dtdevicekit.stacktrace" = (
0 DTDeviceKitBase 0x0000000126772c90 DTDKCreateNSErrorFromAMDErrorCode + 235
1 DTDeviceKitBase 0x00000001267af2ee __90-[DTDKMobileDeviceToken installApplicationBundleAtPath:withOptions:andError:withCallback:]_block_invoke + 155
2 DVTFoundation 0x000000010d758e01 DVTInvokeWithStrongOwnership + 71
3 DTDeviceKitBase 0x00000001267af016 -[DTDKMobileDeviceToken installApplicationBundleAtPath:withOptions:andError:withCallback:] + 1409
4 IDEiOSSupportCore 0x00000001264f07a0 __118-[DVTiOSDevice(DVTiPhoneApplicationInstallation) processAppInstallSet:appUninstallSet:installOptions:completionBlock:]_block_invoke.301 + 3520
5 DVTFoundation 0x000000010d88ea09 __DVT_CALLING_CLIENT_BLOCK__ + 7
6 DVTFoundation 0x000000010d88f51d __DVTDispatchAsync_block_invoke + 196
7 libdispatch.dylib 0x00007ff80da290cc _dispatch_call_block_and_release + 12
8 libdispatch.dylib 0x00007ff80da2a317 _dispatch_client_callout + 8
9 libdispatch.dylib 0x00007ff80da30317 _dispatch_lane_serial_drain + 672
10 libdispatch.dylib 0x00007ff80da30dfd _dispatch_lane_invoke + 366
11 libdispatch.dylib 0x00007ff80da3aeee _dispatch_workloop_worker_thread + 753
12 libsystem_pthread.dylib 0x00007ff80dbddfd0 _pthread_wqthread + 326
13 libsystem_pthread.dylib 0x00007ff80dbdcf57 start_wqthread + 15
);
}
--
Analytics Event: com.apple.dt.IDERunOperationWorkerFinished : {
"device_model" = "iPhone13,2";
"device_osBuild" = "16.3 (20D47)";
"device_platform" = "com.apple.platform.iphoneos";
"launchSession_schemeCommand" = Run;
"launchSession_state" = 1;
"launchSession_targetArch" = arm64;
"operation_duration_ms" = 30367;
"operation_errorCode" = "-402653081";
"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.2";
"sdk_osVersion" = "16.2";
"sdk_variant" = iphoneos;
}
--
System Information
macOS Version 12.6.1 (Build 21G217) Xcode 14.2 (21534) (Build 14C18) Timestamp: 2023-02-10T22:00:34+05:30
Reproduction steps
- change the Project.yml to this config
- Run xcodegen generate
- Build and Run Project
- Issue Pops up
I am experiencing similar issue. The project builds and app installs fine on device, but when building for simulator there is a compile error:
Your target is built for iOS but contains embedded content built for the iOS platform (widgets.appex), which is not allowed.
I've spent several hours trying to understand the issue with no luck.
Hi @slice-dharamd did you solve this issue?
I solved it by double check the config file for the target
Hi @NrmeenTomoum, can you please tell what you changed in the configuration to run the widget?