Simulator on Xcode 10 became terribly slow

扶醉桌前 提交于 2020-01-11 17:08:31

问题


Everything worked perfect on Xcode 9. But after updating to Xcode 10, Simulator started to get huge lags. Super simple animation is working on 2 fps and whole Mac OS is super slow while animation on Simulator is working. Anybody know what happens and how to fix that? Any app or any standard iOS app is the same terrible slow.

Explanation — it is NOT about slow motion that I can switch with Command⌘ + T. I am talking about huge lags. When UIView is flying it appears in another position jerkily. Not smooth slow animation. 2 fps is not slow motion. It is the same fast motion but in 2 FPS!


回答1:


download iOS11.4 simulator and try it. The downside is you cannot test iOS12. But at least you can work on Xcode 10 and get the App released. Note: don’t bother to get Xcode 9.4.1. Or other versions. It won’t fix the problem. The trick is after you run Xcode 10 the first time, it installed the new coresimulator framework to your root folder.




回答2:


What worked for me was switching the values in Debug > Graphics Quality Override of the Simulator menu. Surprisingly, after setting to 'Low' from 'Device Default', lag was gone, and now any value works like a charm.




回答3:


I had the exact same problem as described here after upgrading to XCode10. Every time I opened the simulator, no matter if it was a IphoneX or Iphone SE, my mac crawled to almost a stop and the simulator performed with a couple of FPS.

The following did not work:

  • FramebufferRendererHint settings
  • Reset simulators
  • Reinstall xcode
  • Created new users
  • Delete Xcode 10 and install XCode9
  • Delete CoreSimulator.framework and install new simulators

What finally worked:

  • Revert CoreSimulator.framework and Xcode.app using Time Machine(my last backup was from september 2017, so now im running Xcode9.1, but at least its working again(!))

Not sure if its relevant, but im working on a old IMac mid 2011.




回答4:


I had same problem and this fixed it:

defaults write com.apple.CoreSimulator.IndigoFramebufferServices FramebufferRendererHint X  

Where X is:

0 = auto

1 = Metal

2 = OpenCL

3 = OpenGL




回答5:


Yes, it is NOT about slow motion as you said. Xcode simulator has extremely low performance in global. It is Apple's bug. I have reported it via Feedback Assistant. I have created demo with code demonstrating that simulator is 200 times slower than any old real device. I have found that JavaScript code with Date object executed in WKWebView is pain for simulator. See jsfiddle https://jsfiddle.net/kjms16cw/ I hope Apple will fix it soon!

var log = document.getElementById("log");
document.getElementById("button").onclick = function() { run(); };

function run() {
	var d1 = new Date();
	for (var i = 0; i < 1000; i++) {
		var x = new Date();
		x.setMilliseconds(0);
		x.setSeconds(0);
		x.setMinutes(0);
	}
	var d2 = new Date();
	log.innerHTML = ((d2.getTime() - d1.getTime()) / 1000) + " seconds";
}
<h3>Xcode Simulator Extremely Low Performance</h3>
<p>This test runs fast (several tens milliseconds e.g. 30 ms)
in any browser any device any platform including very old iOS device
e.g. iPhone 5C and several years old iPad 2, BUT IN SIMULATOR IT TAKES 6000 ms 
(yes, 6 seconds!). Terrible!</p>
<button id="button">run()</button>
<div id="log"></div>



回答6:


I had troubles when switching from landscape to portrait. views would just not move.

The only work around I found was Command + Arrow up. This simulates a volume up press, but also refreshes the display after the rotation




回答7:


Update to Xcode 11. If your computer doesn’t meet the requirements for Xcode 11, get another computer.

The reason is that in Xcode 11, the GPU works in the Simulator, for the first time. Xcode 10 tries to emulate GPU based animation on the CPU, and on some machines the result is a train wreck.




回答8:


Make sure "Slow Animations" (Debug > Slow Animations) is not accidentally enabled. I've done it so many times :(



来源:https://stackoverflow.com/questions/52430155/simulator-on-xcode-10-became-terribly-slow

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!