Xcode模拟器黑屏,有错误:“手术无法完成,(Mach错误-308 -(ipc/mig)服务器死亡)”

wmvff8tz  于 2023-05-30  发布在  Mac
关注(0)|答案(2)|浏览(590)

我在模拟器上运行我的应用程序时遇到了问题,我相信这个问题是在我安装Xcode v14.3之后开始的。
我第一次运行这个应用程序时,一切都很好。然而,当我试图重建并再次运行它,而应用程序仍在模拟器上运行时,我遇到了黑屏95%的时间。模拟器变得无响应,我不得不手动关闭它。在这样做之后,我看到一个错误消息(附在这篇文章的末尾)。
我已经尝试了几种解决方案来解决这个问题,但到目前为止没有一个成功。以下是我采取的步骤:
1.已删除模拟器上的所有内容和设置。
1.已删除“派生数据”文件夹。
1.已检查我的防火墙设置,以确保它没有阻止应用程序,但防火墙已禁用。
1.重新安装命令行工具。
1.使用Rosetta打开Xcode
1.格式化我的Mac并执行Xcode的干净安装沿着其他所有内容。
不幸的是,上述步骤都没有解决问题。我找到的唯一临时解决方案是关闭“Debug executable”选项:

然而,这种解决方案并不理想,因为它禁用了整个调试模式工具。因此,我仍在寻找一个更合适的解决办法。
此错误似乎只发生在特定的应用程序项目中,而不会发生在其他项目中。这表明问题可能与特定于有问题项目的配置或代码有关。
我用的是M1芯片的Mac。
错误详细信息:

The operation couldn’t be completed. (Mach error -308 - (ipc/mig) server died)
Domain: NSMachErrorDomain
Code: -308
User Info: {
    DVTErrorCreationDateKey = "2023-05-22 10:00:49 +0000";
    IDERunOperationFailingWorker = IDELaunchiPhoneSimulatorLauncher;
}
--

Analytics Event: com.apple.dt.IDERunOperationWorkerFinished : {
    "device_model" = "iPhone15,2";
    "device_osBuild" = "16.4 (20E247)";
    "device_platform" = "com.apple.platform.iphonesimulator";
    "launchSession_schemeCommand" = Run;
    "launchSession_state" = 1;
    "launchSession_targetArch" = arm64;
    "operation_duration_ms" = 5226;
    "operation_errorCode" = "-308";
    "operation_errorDomain" = NSMachErrorDomain;
    "operation_errorWorker" = IDELaunchiPhoneSimulatorLauncher;
    "operation_name" = IDERunOperationWorkerGroup;
    "param_consoleMode" = 0;
    "param_debugger_attachToExtensions" = 0;
    "param_debugger_attachToXPC" = 1;
    "param_debugger_type" = 3;
    "param_destination_isProxy" = 0;
    "param_destination_platform" = "com.apple.platform.iphonesimulator";
    "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" = 1;
    "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_testing_launchedForTesting" = 0;
    "param_testing_suppressSimulatorApp" = 0;
    "param_testing_usingCLI" = 0;
    "sdk_canonicalName" = "iphonesimulator16.4";
    "sdk_osVersion" = "16.4";
    "sdk_variant" = iphonesimulator;
}
--

System Information

macOS Version 13.3.1 (a) (Build 22E772610a)
Xcode 14.3 (21812) (Build 14E222b)
Timestamp: 2023-05-22T13:00:49+03:00

当运行我的应用程序时,我遇到了另一个错误,它在日志中触发了一条警告消息。我相信这个警告可能与我面临的问题有关:

Warning: Error creating LLDB target at path '/Debug-iphonesimulator/YourApp.app'- using an empty LLDB target which can cause slow memory reads from remote devices.
c8ib6hqw

c8ib6hqw1#

好吧,所以经过吨的测试,我修复了它删除所有

exclude architecture arm64
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = arm64;

从项目的目标构建设置&从所有pod构建设置。

woobm2wo

woobm2wo2#

我也遇到过类似的问题,但对我来说,可以在模拟器中第一次运行该项目,但连续运行,模拟器一直显示黑屏。下面的步骤为我解决了这个问题
1.删除"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = "arm64"如果你有任何调试Any iOS Simulator构建设置
1.如果您碰巧为Pods设置了它,那么在pod文件[和pod安装]中删除它们

  1. close Xcode/simulator
    1.打开Xcode并在Product/Destination/Destination Architecture中选择show rosetta destination
    按照上面的步骤,你现在应该可以跑了。

相关问题