SBMainWorkspace - The request was denied by service delegate
Asked Answered
P

5

13

I’m encountering a bug when launching an app on the simulator which is: The request was denied by service delegate (SBMainWorkspace).

I know that there are some topic about this error, but any solution works for me. 
This is what I have already try:

  • Clean Derived data + project
  • Reset simulator
  • Check empty environment variables (for all target + pod)
  • Update Xcode
  • Reinstall Xcode
  • Restart the Mac (multiple time)
  • Delete project & re clone it
  • Check for Mach-O Type build settings is set to executable
  • Try on different simulators (iPhone 15, 15 Pro & 15 Plus)
  • Try on different iOS versions (16, 17 & 17.0.1)
  • Desintegrate + reinstall pod
  • Kill simulators, restart Xcode
  • Many of the things mentioned above at the same time

Note that this bug only occurs on one specific project. I can run any other project on simulator normally. The same project run also normally on other Mac.

Here’s my configuration: Xcode 15.0.1 (15A507) MacOS Sonoma 14.0 Mac mini M2

Here’s the full error log:

Simulator device returned an error for the requested operation.
Domain: FBSOpenApplicationServiceErrorDomain
Code: 1
Failure Reason: The request was denied by service delegate (SBMainWorkspace).
User Info: {
    BSErrorCodeDescription = RequestDenied;
    FBSOpenApplicationRequestID = 0x9ca3;
    IDERunOperationFailingWorker = IDELaunchiPhoneSimulatorLauncher;
    SimCallingSelector = "launchApplicationWithID:options:pid:error:";
}
--
The request to open "com.---------" failed.
Domain: FBSOpenApplicationServiceErrorDomain
Code: 1
Failure Reason: The request was denied by service delegate (SBMainWorkspace).
User Info: {
    BSErrorCodeDescription = RequestDenied;
    FBSOpenApplicationRequestID = 0x9ca3;
}
--
The operation couldn’t be completed. The process failed to launch.
Domain: FBProcessExit
Code: 64
Failure Reason: The process failed to launch.
User Info: {
    BSErrorCodeDescription = "launch-failed";
}
--
The operation couldn’t be completed. Launch failed.
Domain: RBSRequestErrorDomain
Code: 5
Failure Reason: Launch failed.
--
Launchd job spawn failed
Domain: NSPOSIXErrorDomain
Code: 111
--

Event Metadata: com.apple.dt.IDERunOperationWorkerFinished : {
    "device_model" = "iPhone16,1";
    "device_osBuild" = "17.0.1 (21A342)";
    "device_platform" = "com.apple.platform.iphonesimulator";
    "dvt_coredevice_version" = "348.1";
    "dvt_mobiledevice_version" = "1643.2.4";
    "launchSession_schemeCommand" = Run;
    "launchSession_state" = 1;
    "launchSession_targetArch" = arm64;
    "operation_duration_ms" = 11035;
    "operation_errorCode" = 1;
    "operation_errorDomain" = FBSOpenApplicationServiceErrorDomain;
    "operation_errorWorker" = IDELaunchiPhoneSimulatorLauncher;
    "operation_name" = IDERunOperationWorkerGroup;
    "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" = 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_structuredConsoleMode" = 1;
    "param_testing_launchedForTesting" = 0;
    "param_testing_suppressSimulatorApp" = 0;
    "param_testing_usingCLI" = 0;
    "sdk_canonicalName" = "iphonesimulator17.0";
    "sdk_osVersion" = "17.0";
    "sdk_variant" = iphonesimulator;
}
--

Update

I have try with another Xcode version (14.3.1) without success, the same error occur. Work perfectly on my personal phone..

I investigate log with this command:

xcrun simctl spawn booted log show --info --debug --predicate 'processImagePath contains "CoreSimulatorBridge"'

I found a lot of strange log which said "Bootstraping failed" but it's to deep for me to understand. I'll give you more log details if you ask for.

Partite answered 7/11, 2023 at 11:37 Comment(0)
K
32

I have been trying the above steps and formatting my complete system again for the past 24 hours.
What finally worked for me was the step I was trying to avoid.
Install rosetta running this command on the Terminal:
softwareupdate --install-rosetta

Kress answered 9/11, 2023 at 6:56 Comment(9)
I have see this step too but I was trying to avoid it too ahah. I can't try it now but I'll try next Monday. I'll tell you if it's works.Partite
Can you give a little more context why rosetta might be the thing here? Have you launched XCode unter rosetta?Adhesive
Since any new project I was creating was working perfectly fine. I think this has to do either with some dependency library that was being used in that particular repo or some build setting set there.Kress
I was facing same using Xcode 15, in my case is something specifically with cocoapods, projects without cocoapods were working fine. And this solution also worked for me but I don't like it (using rosetta)Saraisaraiya
I didn't even notice any update in my mac. The error appeared out of nowhere. After softwareupdate now it's working.Hint
I was trying to avoid Rosetta too and spent much time. This worked. Thank you.Gilthead
Some context: Simulators (from iOS 14 up) support both arm64 and x86_64 apps. However, for x86 apps, they require Rosetta 2, a compatibility framework from Apple that basically emulates x86 on Apple Silicon (arm64). Your app might use pre-compiled dependencies that don't include arm64 binaries for the Simulator, and can thus only be executed as x86. Installing Rosetta makes it launchable in the Simulator. See susuthapa19961227.medium.com/…Ballroom
Worked for me, thank you. Didn't knew there was such cool software.Aston
Worked for me. Thank you.Quipu
S
10

encounter the similar problem on actual device (iPhone, iPad), it turn out is because a accident added empty Environment Variable in Arguments tab of PRODUCT>SCHEME>EDIT SCHEME>Run (Xcode automatically add this variable even if you revert the code back to old commit...), after remove the empty environment variable, everything works again

Stannwood answered 9/12, 2023 at 20:18 Comment(1)
As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.Leotie
R
2

Select "Any iOS Device" as the build target: Open Xcode and navigate to the project settings. Under the "Build Settings" tab, search for "Supported Platforms". Make sure "iOS" is selected and not "Iphoneos".

Ratib answered 21/4, 2024 at 1:39 Comment(0)
O
0

Hi had the same error my solution was to delete the source folder and clone it again.

Ommatophore answered 10/11, 2023 at 8:42 Comment(1)
Already try too, I forgot to mentioned it, I will update my postPartite
S
0

For everyone who still have the issue after tried @Jerin answer. You can try to re-add all keychains which related to XCode on your mac. I already solve the issue after add all keychain after reset my M1.

Selfimmolation answered 13/7, 2024 at 11:53 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.