Xcode 10 上的 iOS 模拟器崩溃
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/52500234/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
iOS Simulator Crash on Xcode 10
提问by Vineet Choudhary
Today, I've updated my iMac to macOS Mojave from macOS High Sierra. Since then I'm not able to open simulator. Every time I tried to open the simulator that crashes immediately. Whenever I tried to run the simulator via Xcode then Xcode shows this error
今天,我已经将我的 iMac 从 macOS High Sierra 更新到了 macOS Mojave。从那以后我无法打开模拟器。每次我试图打开立即崩溃的模拟器。每当我尝试通过 Xcode 运行模拟器时,Xcode 都会显示此错误
Timed out waiting for the simulator application for iphonesimulator to become ready
等待 iphonesimulator 的模拟器应用程序准备就绪时超时
Also, I tried to open the simulator directly and it's crash immediately. Here the gif (gif is a little bit slow) -
另外,我尝试直接打开模拟器,它立即崩溃。这里的gif(gif有点慢)-
System CPU & Memory Status-
系统 CPU 和内存状态-
Here some solution that I've tried but no luck -
这里有一些我尝试过但没有运气的解决方案 -
Clear iPhone Simulator Cache
xcrun simctl erase all
Clear DerivedData
~/Library/Developer/Xcode/DerivedData/
Clear iOS DeviceSupport
~/Library/Developer/Xcode/iOS DeviceSupport/
Delete Xcode Preferences
defaults delete com.apple.dt.Xcode
Restart Xcode & System
清除 iPhone 模拟器缓存
xcrun simctl erase all
清除派生数据
~/Library/Developer/Xcode/DerivedData/
清除 iOS 设备支持
~/Library/Developer/Xcode/iOS DeviceSupport/
删除 Xcode 首选项
defaults delete com.apple.dt.Xcode
重启 Xcode 和系统
Update 1
更新 1
macOS Logs -
macOS 日志 -
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Device iPhone XS (978302BA-5255-44CB-A77C-188071B99A7C, iOS 12.0, Booted) is available but has no defaultDisplay'
*** First throw call stack:
(
0 CoreFoundation 0x00007fff33a9543d __exceptionPreprocess + 256
1 libobjc.A.dylib 0x00007fff5f9a6720 objc_exception_throw + 48
2 CoreFoundation 0x00007fff33ab008e +[NSException raise:format:arguments:] + 98
3 Foundation 0x00007fff35e4c55d -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 194
4 Simulator 0x000000010e7510da Simulator + 106714
5 libdispatch.dylib 0x00007fff60a24d4f _dispatch_call_block_and_release + 12
6 libdispatch.dylib 0x00007fff60a25dcb _dispatch_client_callout + 8
7 libdispatch.dylib 0x00007fff60a2c120 _dispatch_lane_serial_drain + <…>
)
回答by Evgeny Karkan
This command should fix your issue (close sim before and open after):
此命令应该可以解决您的问题(之前关闭 sim 并在之后打开):
sudo killall -10 com.apple.CoreSimulator.CoreSimulatorService
After this, restart Xcode and if simulator not available then we need to add them manually from Windows
> Device and Simulators
在此之后,重新启动 Xcode,如果模拟器不可用,那么我们需要从Windows
>手动添加它们Device and Simulators
回答by Mussa Charles
This resolved my issue
这解决了我的问题
Force quit simulator by:- option + command + escchoose simulator and quit.
Quit Xcode and restart then it worked!
通过以下方式强制退出模拟器:- option + command + esc选择模拟器并退出。
退出 Xcode 并重新启动,然后它就成功了!