AWS Mac主机上xcodebuild无法在iOS Simulator启动应用求助
问题
在AWS Mac主机上执行xcodebuild命令时,无法在iOS Simulator中启动应用。执行的命令如下:
xcodebuild ONLY_ACTIVE_ARCH=NO CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO ENABLE_TESTABILITY=YES -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 14,OS=16.0' -workspace XXXXX.xcworkspace -scheme Stage -configuration Debug test -verbose
报错信息:
iOSSimulator: F9291ED3-BEA6-4772-AF51-DBE1322E857B: Failed to launch app with identifier: XXXXX and options: { "activate_suspended" = 0; arguments = ( ); environment = { "CA_ASSERT_MAIN_THREAD_TRANSACTIONS" = 0; "CA_DEBUG_TRANSACTIONS" = 0; "DYLD_FRAMEWORK_PATH" = "/Users/ec2-user/Library/Developer/Xcode/DerivedData/XXXXX-clanoahlzfruqucjqmwowignexic/Build/Products/Debug-iphonesimulator:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/Frameworks"; "DYLD_INSERT_LIBRARIES" = "/Users/ec2-user/Library/Developer/Xcode/DerivedData/XXXXX-clanoahlzfruqucjqmwowignexic/Build/Products/Debug-iphonesimulator/Stage.app/Frameworks/libXCTestBundleInject.dylib:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libMainThreadChecker.dylib"; "DYLD_LIBRARY_PATH" = "/Users/ec2-user/Library/Developer/Xcode/DerivedData/XXXXX-clanoahlzfruqucjqmwowignexic/Build/Products/Debug-iphonesimulator:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/lib"; "LLVM_PROFILE_FILE" = "/var/folders/sz/hvcsl7r53m3_n5l152_210c80000gn/T/com.XXXXX.pm-stage/5B3CB5FD-748E-4FAF-B84D-C47CE86F09B9-35456-0000112C6005E8EB/773D2FD5-5D40-4A63-8E37-F3C33A6FB45B-%p%c.profraw"; "MTC_CRASH_ON_REPORT" = 1; NSApplicationQuitWithoutSuddenTermination = YES; NSUnbufferedIO = YES; NSZombieEnabled = YES; "OS_ACTIVITY_DT_MODE" = YES; "OS_ACTIVITY_MODE" = disable; "RUN_DESTINATION_DEVICE_NAME" = "iPhone 14"; "RUN_DESTINATION_DEVICE_PLATFORM_IDENTIFIER" = "com.apple.platform.iphonesimulator"; "RUN_DESTINATION_DEVICE_UDID" = "F9291ED3-BEA6-4772-AF51-DBE1322E857B"; "SQLITE_ENABLE_THREAD_ASSERTIONS" = 1; XCInjectBundleInto = unused; XCTestBundlePath = "PlugIns/UnitTests.xctest"; XCTestConfigurationFilePath = ""; XCTestSessionIdentifier = "590D832A-0830-4798-A990-1555B39E090B"; "__XCODE_BUILT_PRODUCTS_DIR_PATHS" = "/Users/ec2-user/Library/Developer/Xcode/DerivedData/XXXXX-clanoahlzfruqucjqmwowignexic/Build/Products/Debug-iphonesimulator"; "__XPC_DYLD_FRAMEWORK_PATH" = "/Users/ec2-user/Library/Developer/Xcode/DerivedData/XXXXX-clanoahlzfruqucjqmwowignexic/Build/Products/Debug-iphonesimulator"; "__XPC_DYLD_LIBRARY_PATH" = "/Users/ec2-user/Library/Developer/Xcode/DerivedData/XXXXX-clanoahlzfruqucjqmwowignexic/Build/Products/Debug-iphonesimulator"; "__XPC_LLVM_PROFILE_FILE" = "/var/folders/sz/hvcsl7r53m3_n5l152_210c80000gn/T/com.XXXXX.pm-stage/5B3CB5FD-748E-4FAF-B84D-C47CE86F09B9-35456-0000112C6005E8EB/773D2FD5-5D40-4A63-8E37-F3C33A6FB45B-%p%c.profraw"; }; stderr = "/dev/ttys003"; stdout = "/dev/ttys003"; "terminate_running_process" = 1; "wait_for_debugger" = 0; } (error = Error Domain=NSPOSIXErrorDomain Code=3 "No such process" UserInfo={NSLocalizedDescription=Application launch for 'com.XXXXX.pm-stage' did not return a valid pid nor a launch error.}) 2022-10-27 00:15:47.875 xcodebuild[35456:2529897] IDETestOperationsObserverDebug: Failure collecting logarchive: Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service named com.apple.testmanagerd.control was invalidated: failed at lookup with error 3 - No such process." UserInfo={NSDebugDescription=The connection to service named com.apple.testmanagerd.control was invalidated: failed at lookup with error 3 - No such process.} 2022-10-27 00:16:04.141 xcodebuild[35456:2529810] [MT] IDETestOperationsObserverDebug: 35.913 elapsed -- Testing started completed. 2022-10-27 00:16:04.141 xcodebuild[35456:2529810] [MT] IDETestOperationsObserverDebug: 0.000 sec, +0.000 sec -- start 2022-10-27 00:16:04.141 xcodebuild[35456:2529810] [MT] IDETestOperationsObserverDebug: 35.913 sec, +35.913 sec -- end Testing failed: Application launch for 'com.XXXXX.pm-stage' did not return a valid pid nor a launch error. Stage encountered an error (Failed to install or launch the test runner. If you believe this error represents a bug, please attach the result bundle at /Users/ec2-user/Library/Developer/Xcode/DerivedData/XXXXX-clanoahlzfruqucjqmwowignexic/Logs/Test/Test-Stage-2022.10.27_00-14-24-+0000.xcresult. (Underlying Error: Application launch for 'com.XXXXX.pm-stage' did not return a valid pid nor a launch error. No such process)) ** TEST FAILED **
可能的故障原因
- Simulator运行环境异常:AWS Mac主机的Simulator可能因后台进程冲突、资源不足导致无法正常启动应用,建议重启Simulator或重置Simulator内容和设置。
- Xcode衍生数据损坏:DerivedData目录下的缓存文件可能已损坏,直接删除该目录后重新执行构建命令。
- 测试框架注入问题:
DYLD_INSERT_LIBRARIES中的libXCTestBundleInject.dylib路径可能存在权限问题或文件损坏,检查文件是否存在,或者尝试重新生成测试目标。 - iOS版本兼容性:指定的iOS 16.0 Simulator可能与当前Xcode版本不兼容,确认Xcode版本是否支持该Simulator runtime,或者更换为兼容的iOS版本进行测试。
- 系统服务异常:
com.apple.testmanagerd.control服务崩溃或未正常启动,尝试重启主机或手动重启该服务。
内容的提问来源于stack exchange,提问作者Taha Selim Bebek
相关产品推荐
相关产品推荐

