我在Xcode 7中获得了一个带有viewWillTransitionToSize的EXC_BAD_ACCESS。这里发布的解决方案EXC_BAD_ACCESS with viewWillTransitionToSize and Xcode 6.3起作用,直到我升级到XCode 7。
override func viewWillTransitionToSize(size: CGSize, withTransitionCoordinator coordinator: UIViewControllerTransitionCoordinator)
{
super.viewWillTransitionToSize(size, withTransitionCoordinator: coordinator)
if let safeCoordinator = coordinator as UIViewControllerTransitionCoordinator?
{
// Error: EXC_BAD_ACCESS here
print("coordinator != nil")
safeCoordinator.animateAlongsideTransition({ context in
self.tableView.frame = CGRectMake(0, 0, size.width, size.height)
}, completion: nil)
} else {
print("coordinator == nil")
}
}
任何帮助都会得到满足。