xcodebuild测试:无法启动模拟器:-10827

问题描述 投票:9回答:3

我正在运行构建代理作为启动代理。当我尝试运行“xcodebuild test ...”时出现此错误:

2016-07-14 16:31:00.535 xcodebuild[11579:21390] [MT] iPhoneSimulator: Could not launch simulator: -10827 xcodebuild: error: Failed to build project XcodeTestsTest1 with scheme XcodeTestsTest1. Reason: The operation couldn’t be completed. (OSStatus error -10827.)

你对这个问题怎么解决了吗?

谢谢!

automated-tests xcodebuild
3个回答
8
投票

我有同样的问题。这是因为Mac OS X不允许iOS模拟器在后台运行。

如果您正在构建Jenkins CI环境,并尝试通过模拟器进行单元测试,则无法运行模拟器,因为Jenkins基本上是作为DAEMON运行的。如果您在tmux或screen等环境中运行测试,也会发生这种情况。

Here是一个很好的教程,可以帮助您解决这个问题。

干杯!


1
投票

对我来说这有帮助 - 关闭XCode和模拟器(如果正在运行) - 打开终端并键入:

ps -ax | grep simdeviceio | grep -v grep

这在我的Mac上有一些输出:

50755   ??  Ss     0:00.67 /Library/Developer/PrivateFrameworks/CoreSimulator.framework/Versions/A/Resources/SimStreamProcessorServices.simdeviceio/Contents/XPCServices/SimStreamProcessorService.xpc/Contents/MacOS/SimStreamProcessorService
50756   ??  Ss     0:00.07 /Library/Developer/PrivateFrameworks/CoreSimulator.framework/Versions/A/Resources/SimAudioProcessorServices.simdeviceio/Contents/XPCServices/SimAudioProcessorService.xpc/Contents/MacOS/SimAudioProcessorService

通过使用kill命令键入其PID(上面一行中的第一个数字),可以手动杀死这2个进程:

kill -9 50755 50756

或者

ps ax | grep simdeviceio | grep -v grep | awk '{print $1}' | xargs kill -9

0
投票

如果你跑

xcrun simctl boot "iPhone 7"

然后

run xcodebuild test

然后用清理后

xcrun simctl shutdown "iPhone 7"

注意:您必须在要尝试运行此功能的框上的某个位置运行活动用户会话。

© www.soinside.com 2019 - 2024. All rights reserved.