简体   繁体   中英

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.

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. 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.

Here's Instruments screenshot. 截图

It seems obj_msgSend is taking up the maximum CPU usage, but I read here that Objective-C is not the real problem. How should I handle this? It is happening only after I updated to 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. The height of the UITextView was dependent on something which was dependent on height itself, and hence it could never be determined.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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