ViewControllerA
ViewControllerB
使用模态 segue打开。
ViewControllerA
:
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
{
// ModalSegue is defined in the storyboard to point to ViewControllerB
[self performSegueWithIdentifier:@"ModalSegue" sender:self];
}
ViewControllerB
:
- (IBAction)cancelButtonTapped:(id)sender
{
[self dismissViewControllerAnimated:YES completion:nil]; // Causes crash
}
在 iOS 7.1 中,这会导致 EXC_BAD_ACCESS 崩溃。如果 Zombie Objects 被打开,它会抛出异常:
*** -[ViewControllerB respondsToSelector:]: message sent to deallocated instance 0x12ed7e170
在 iOS 7.0 中,这按预期工作。
有任何想法吗?
编辑:根据 LeoNatan 的要求,这里是dealloc
方法的堆栈跟踪ViewControllerB
: