简体   繁体   English

obj_msgSend上的CPU使用率100%

[英]100% CPU usage on obj_msgSend

I upgraded to XCode 7 and Swift 2. My CPU usage goes to 100% when I try to instantiate and push a specific ViewController. 我升级到XCode 7和Swift2。当我尝试实例化并推送特定的ViewController时,CPU使用率达到100%。

let dummyVC = self.storyboard!.instantiateViewControllerWithIdentifier("dummy") as! DummyViewController
self.navigationController!.pushViewController(dummyVC, animated: true)

I am able to push any other View Controller, but not this one. 我可以推送其他任何View Controller,但不能推送此一个。 Also, if I don't push the ViewController, my app doesn't freeze(CPU doesn't go to 100%), and this dummyVC causes the freeze from everywhere I try to push it. 另外,如果我不推送ViewController,我的应用程序也不会冻结(CPU不会达到100%),并且这个dummyVC会导致我尝试推送它的任何地方发生冻结。

Here's Instruments screenshot. 这是Instruments屏幕截图。 截图

It seems obj_msgSend is taking up the maximum CPU usage, but I read here that Objective-C is not the real problem. 似乎obj_msgSend占用了最大的CPU使用率,但是我在这里阅读到Objective-C并不是真正的问题。 How should I handle this? 我该如何处理? It is happening only after I updated to Swift 2. 仅在我更新到Swift 2之后才发生。

So it turned out that there was a UITextView in Storyboard and this issue happened while setting up the UITextView because of the deadlock in constraints. 因此事实证明,情节提要中有一个UITextView ,并且由于约束的死锁而在设置UITextView发生了此问题。 The height of the UITextView was dependent on something which was dependent on height itself, and hence it could never be determined. UITextView的高度取决于某些东西,而某些东西又取决于高度本身,因此永远无法确定。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM