layer is a part of cycle in its layer tree iOS 9 S

2019-04-21 01:46发布

When I load my view controller I'm getting this error:

*** Terminating app due to uncaught exception 'CALayerInvalid', reason: 'layer <CALayer: 0x7fda42c66e30> is a part of cycle in its layer tree'

I don't know why. I think I might've added a third party framework that messed with layers, but I removed it in my troubleshooting. Any insights would be great.

EDIT

It happens during viewDidLoad of my tableViewcontroller. I have a tableView on my second vc. I've narrowed it down to it crashing on setting the heightForRowAtIndexPath on the 4th custom cell. The cell is on a static tableView................. :/ Getting closer!

Here's my heightForRowAtIndexPath:

override func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat {

    print("idx = \(indexPath.row)")

    return super.tableView(tableView, heightForRowAtIndexPath: indexPath)
}

Pretty generic. Any thoughts on where else this might be caused?

7条回答
时光不老,我们不散
2楼-- · 2019-04-21 02:08

I've managed to fix it but not in the way that I'd hoped. I ended up scratching the tableViewCell that was causing the issue and rebuilding all the layout constraints from scratch. Not ideal, but it worked. I hope someone can come along in the future and explain why this error happened! Cheers.

查看更多
登录 后发表回答