I’m making an attempt to launch my iOS app on the simulator utilizing command-line instruments, possible for automated testing for Maestro. I can efficiently construct the app utilizing xcodebuild
and set up it onto the goal simulator utilizing xcrun simctl set up. The set up seems profitable (the app icon reveals up on the simulator) and if I click on it it opens app efficiently.
Nevertheless, when I attempt to launch the app utilizing xcrun simctl launch "$SIMULATOR_TARGET" "$BUNDLE_ID"
it fails instantly with the next error
Underlying error (area=FBSOpenApplicationServiceErrorDomain, code=4):
If I construct and run the very same scheme and configuration (Debug) instantly from Xcode, into the very same simulator occasion, the app launches and runs completely with none points.
That is my full construct and run bash script.
Which fails on the final command.
xcodebuild -project MyProject.xcodeproj
-configuration Debug
-scheme "MyAppScheme (Debug)"
-destination 'platform=iOS Simulator,title=iPhone 16 Professional'
-derivedDataPath construct
APP_PATH="construct/Construct/Merchandise/Debug-iphonesimulator/MyAppName.app" SIMULATOR_TARGET="..."
BUNDLE_ID="com.mycompany.myapp.debug"
xcrun simctl set up "$SIMULATOR_TARGET" "$APP_PATH"
xcrun simctl launch "$SIMULATOR_TARGET" "$BUNDLE_ID"
What I’ve Tried (and did not resolve the difficulty):
-
Verified Bundle ID: Confirmed the $BUNDLE_ID utilized in simctl launch precisely matches the CFBundleIdentifier within the constructed Information.plist.
-
Verified .app Path: Confirmed the $APP_PATH exists and factors to the proper .app bundle after the construct.
-
Handbook Launch: Tapping the icon on the simulator after simctl set up additionally fails to launch the app correctly (seems to crash or just would not open).
-
Simulator Logs: Checked logs by way of Console.app on the Mac, filtering for the simulator and the app’s bundle ID/title across the time of the failed launch. Discovered no apparent crash studies or particular errors explaining the launch failure. Additionally tried xcrun simctl spawn booted log stream –level debug with out pinpointing the trigger.
-
Erase Simulator: Used “Machine -> Erase All Content material and Settings…” on the simulator and tried the set up/launch course of once more.
-
Clear Construct: Used xcodebuild clear earlier than rebuilding.
-
Checked Scheme Settings: Verified in Xcode (Edit Scheme -> Run -> Arguments) that “Surroundings Variables” and “Arguments Handed On Launch” are each fully empty for the Debug configuration.
-
Checked Construct Settings: Confirmed SKIP_INSTALL = NO for the Debug configuration.
-
Checked Construct Phases: Confirmed the scheme is accurately configured to construct the primary utility goal.
-
Checked Information.plist Validity: Confirmed CFBundleVersion is a legitimate integer string (e.g. 1 or 123).
What might clarify this discrepancy the place the app runs completely from Xcode, however constantly fails to launch by way of xcrun simctl launch with FBSOpenApplicationServiceErrorDomain, given all of the troubleshooting steps already carried out?
Are there every other potential causes associated to the simctl launch atmosphere, particular system service interactions, or delicate construct variations that I is perhaps lacking? What additional diagnostic steps might assist the foundation reason for this command-line launch failure?