Thanks for being a part of WWDC25!

How did we do? We’d love to know your thoughts on this year’s conference. Take the survey here

Unable to run test in devices with MDM Profiles

Requirement :

We wanted to run UI Automation using xcuitest in devices with MDM profiles.

Steps :

  1. We have created a test target for our app and signed with MDM profile (in-house)
  2. Generated app and testbundle-Runner along with xctestrun files using “xcodebuild build-for-testing -scheme “App-TestRelease" -configuration “Release” -derivedDataPath "${CURDIR}/derivedData" -workspace "${PROJECT_NAME}.xcworkspace" -sdk iphoneos”
  3. Tried running “xcodebuild test-without-building -destination platform=iOS,id=000842883-**** -xctestrun App-TestRelease_iphoneos17.5-arm64.xctestrun -derivedDataPath /derived/“
  4. Facing below issues

xcodebuild[35481:3588352]  IDELaunchReport: e2934a094f300d40:e2934a094f300d40: Finished with error: Unable to launch com.org.mdm.XCTest.xctrunner

Domain: com.apple.platform.iphoneos
Code: -12
User Info: {
    IDERunOperationFailingWorker = IDELaunchiPhoneLauncher;
}
--
Request to launch com.org.mdm.XCTest.xctrunner failed.
Domain: com.apple.dt.deviceprocesscontrolservice
Code: 2
Failure Reason: The request to open "com.org.mdm.XCTest.xctrunner" failed. : Failed to launch process with bundle identifier 'com.org.mdm.XCTest.xctrunner'.
--
The request to open "com.org.mdm.XCTest.xctrunner" failed.
Domain: FBSOpenApplicationServiceErrorDomain
Code: 1
Failure Reason: The request was denied by service delegate (SBMainWorkspace) for reason: Security ("Unable to launch com.org.mdm.XCTest.xctrunner because it has an invalid code signature, inadequate entitlements or its profile has not been explicitly trusted by the user").
User Info: {
    BSErrorCodeDescription = RequestDenied;
    FBSOpenApplicationRequestID = 0x9f9;
}
--
The operation couldn’t be completed. Unable to launch com.org.mdm.XCTest.xctrunner because it has an invalid code signature, inadequate entitlements or its profile has not been explicitly trusted by the user.
Domain: FBSOpenApplicationErrorDomain
Code: 3
Failure Reason: Unable to launch com.org.mdm.XCTest.xctrunner because it has an invalid code signature, inadequate entitlements or its profile has not been explicitly trusted by the user.
User Info: {
    BSErrorCodeDescription = Security;
}

Could anyone provide any solution for this ?

Unable to run test in devices with MDM Profiles
 
 
Q