0%

Xcode真机调试提示Unable to install [appName]

git拉代码到本地后,编译没有问题,但是Xcode一运行在安装app的时候就失败,弹窗提示

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
Details

Unable to install "XXX"
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 = "2022-08-18 07:53:05 +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 0x000000028daad614 DTDKCreateNSErrorFromAMDErrorCode + 272
1 DTDeviceKitBase 0x000000028dae6dd8 __90-[DTDKMobileDeviceToken installApplicationBundleAtPath:withOptions:andError:withCallback:]_block_invoke + 160
2 DVTFoundation 0x0000000102eb5bd0 DVTInvokeWithStrongOwnership + 76
3 DTDeviceKitBase 0x000000028dae6b30 -[DTDKMobileDeviceToken installApplicationBundleAtPath:withOptions:andError:withCallback:] + 1336
4 IDEiOSSupportCore 0x0000000133351590 __118-[DVTiOSDevice(DVTiPhoneApplicationInstallation) processAppInstallSet:appUninstallSet:installOptions:completionBlock:]_block_invoke.301 + 2916
5 DVTFoundation 0x0000000102fdcf50 __DVT_CALLING_CLIENT_BLOCK__ + 16
6 DVTFoundation 0x0000000102fde068 __DVTDispatchAsync_block_invoke + 364
7 libdispatch.dylib 0x00000001a2504e60 _dispatch_call_block_and_release + 32
8 libdispatch.dylib 0x00000001a2506bac _dispatch_client_callout + 20
9 libdispatch.dylib 0x00000001a250e330 _dispatch_lane_serial_drain + 672
10 libdispatch.dylib 0x00000001a250eea4 _dispatch_lane_invoke + 392
11 libdispatch.dylib 0x00000001a2519708 _dispatch_workloop_worker_thread + 656
12 libsystem_pthread.dylib 0x00000001a26c15b0 _pthread_wqthread + 288
13 libsystem_pthread.dylib 0x00000001a26c02c4 start_wqthread + 8
);
}
--

Analytics Event: com.apple.dt.IDERunOperationWorkerFinished : {
"device_model" = "iPhone9,2";
"device_osBuild" = "15.6 (19G71)";
"device_platform" = "com.apple.platform.iphoneos";
"launchSession_schemeCommand" = Run;
"launchSession_state" = 1;
"launchSession_targetArch" = arm64;
"operation_duration_ms" = 6186;
"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_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_swiftVersion" = "5.6.1";
"param_runnable_type" = 2;
"param_testing_launchedForTesting" = 0;
"param_testing_suppressSimulatorApp" = 0;
"param_testing_usingCLI" = 0;
"sdk_canonicalName" = "iphoneos15.5";
"sdk_osVersion" = "15.5";
"sdk_variant" = iphoneos;
}
--


System Information

macOS Version 12.0.1 (Build 21A559)
Xcode 13.4.1 (20504) (Build 13F100)
Timestamp: 2022-08-18T15:53:05+08:00

先clean工程,再删DerivedData文件,重启手机,重启电脑,但是都没有用。clean、删除好几遍都没有用,其实到这里就可以肯定是和缓存没关系了,再怎么clean都没用,因为可能是其他地方的原因导致的。完全clean两次如果没用就应该找其他原因了,如果早意识到这一点还可以节省点时间。

查了1个半小时,就发现一篇文章提到删除target里的通知扩展,删除后确实可以运行安装,但是这不是解决办法啊。估摸着大概就是通知扩展那一块有问题,于是比对好的工程的设置,最终发现是NotificationService.swift文件没有加到NotificationService target里去导致的。添加后解决。网上好多类似的问题,但和我这个完全一样的几乎没有,好浪费时间无语。

觉得文章有帮助可以打赏一下哦!