无法在 Xcode 10 中查找屏幕比例和意外的物理屏幕方向
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/52410471/
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
Unable to look up screen scale and Unexpected physical screen orientation in Xcode 10
提问by Pasosta
I have recently updated Xcode to version 10, and now my console displays:
我最近将 Xcode 更新到版本 10,现在我的控制台显示:
MyApp[1618:133310] [AXMediaCommon] Unable to look up screen scale
MyApp[1618:133310] [AXMediaCommon] Unexpected physical screen orientation
MyApp[1618:133310] [AXMediaCommon] Unable to look up screen scale
MyApp[1618:133310] [AXMediaCommon] Unable to look up screen scale
MyApp[1618:133310] [AXMediaCommon] Unexpected physical screen orientation
This only happens when I am running the app in the simulator. I have not changed my code since updating, and nothing appears to have broken in the app. What do these logs mean, and how can I resolve them?
这只发生在我在模拟器中运行应用程序时。更新后我没有更改我的代码,应用程序中似乎没有任何问题。这些日志是什么意思,我该如何解决?
采纳答案by Ricardo Isidro
It could sounds dummy, but these warning appeared me after move the simulator previously rendered from the Macbook screen, to a wider external screen.
这听起来可能很假,但是在将之前渲染的模拟器从 Macbook 屏幕移动到更宽的外部屏幕后,这些警告出现了。
I solved it just restarting the simulator in the external screen. My 2 cents.
我只是在外部屏幕中重新启动模拟器解决了它。我的 2 美分。
回答by Woody Huang
I've met the same problem. Finally I find out that this is because I accidentally resize the simulator's screen using my mouse cursor. By quiting and restarting the simulator my problem is solved.
我遇到了同样的问题。最后我发现这是因为我不小心使用鼠标光标调整了模拟器屏幕的大小。通过退出并重新启动模拟器,我的问题就解决了。
Hope the aforementioned information helps.
希望上述信息有帮助。
回答by gbroekstg
This won't answer your original question, but it might relieve your eyes. A caveatto this answer however is that it disables all NSLogstatements.
这不会回答你最初的问题,但它可能会让你的眼睛放松。然而,这个答案的一个警告是它禁用了所有 NSLog语句。
Do the following to suppress - all NSLog statements including - the warning: Unable to look up screen scale
:
执行以下操作以抑制 - 所有 NSLog 语句,包括 - 警告Unable to look up screen scale
::
In Xcode, go to Product - Scheme - Edit Scheme, select 'Run' on the left side ...
在 Xcode 中,转到 Product - Scheme - Edit Scheme,在左侧选择“运行”...
... and add OS_ACTIVITY_MODE
with value "disable" in the Environment variables
section.
...并OS_ACTIVITY_MODE
在该Environment variables
部分添加值“禁用” 。
回答by Hugo Alonso
I encountered this issue after running some UITest from a gitlab-runner.
从 gitlab-runner 运行一些 UITest 后,我遇到了这个问题。
The simulator got into this state and the only way to solve it was to go to Hardware -> Erase all content and settings
模拟器进入这种状态,解决它的唯一方法是转到硬件 -> 擦除所有内容和设置
回答by Ramin
回答by C??ng Nguy?n
I got the issue, when I was running on iOS 12.2 and MacOS Majove (Version 10.14.4) Just change to iOS 11.4 and everything working perfectly.
我遇到了问题,当我在 iOS 12.2 和 MacOS Majove(版本 10.14.4)上运行时,只需更改为 iOS 11.4,一切正常。
回答by skim
I've experienced something similar. If restarting simulator doesn't do the trick, check your UI test code. Make sure your setup
calls super.setup()
somewhere:
我也经历过类似的事情。如果重新启动模拟器不起作用,请检查您的 UI 测试代码。确保您的setup
电话在super.setup()
某处:
override func setup() {
super.setup()
// ....
}