ios - PresentViewController 在 iOS 6 上崩溃

标签 ios crash sigabrt

我的应用程序出现了奇怪的崩溃问题。一旦我从 A ViewController 进入 B ViewController,它就会崩溃(不是每次,只发生一次)。这是代码

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 
{   
    NSUInteger row = [indexPath row];  
    NSUInteger section = [indexPath section];

    if( section == 0 && row == 0 && self.uidString && self.profileDic)
    {
            BViewController *bviewcontroller = [[BViewController alloc] init];
            [bviewcontroller setProfileDic:self.profileDic];
            bviewcontroller.delegate = self;
            bviewcontroller.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
            [self presentModalViewController:bviewcontroller animated:YES];
            [bviewcontroller release];
    }
}

崩溃日志是

Date/Time:       2013-06-18 10:00:39.720 +0800
OS Version:      iOS 6.1.4 (10B350)
Report Version:  104

Exception Type:  EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Crashed Thread:  0

Last Exception Backtrace:
0   CoreFoundation                  0x31d3c3e2 __exceptionPreprocess + 158
1   libobjc.A.dylib                 0x39a3795e objc_exception_throw + 26
2   CoreFoundation                  0x31d3c298 +[NSException raise:format:arguments:] + 96
3   Foundation                      0x32612f9e -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 86
4   UIKit                           0x33c37754 -[UIWindowController transition:fromViewController:toViewController:target:didEndSelector:] + 172
5   UIKit                           0x33c36fa6 -[UIViewController presentViewController:withTransition:completion:] + 3394
6   UIKit                           0x33d58d9e -[UIViewController presentModalViewController:animated:] + 26

我寻找答案,这里的一些帖子说这是因为 UIViewController 的“presentViewController”方法在 iOS 4.3 上不可用,解决方案是将“presentViewController”更改为“presentModalViewController”。但这正是我的代码所做的。那么有人知道会发生什么吗?提前致谢。

最佳答案

您可能需要将呈现的 View Controller 保留在某处(例如在 iVar 中)。我猜它在出现之前就被释放了。

关于ios - PresentViewController 在 iOS 6 上崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17170716/

相关文章:

android - 如何使用 ACRA 发送 Android 崩溃报告

C++调试: Terminated with SIGABRT

c++ - 进程何时获得 SIGABRT(信号 6)?

c++ - 如何调试令人困惑的大代码?

ios - "Terminating app due to uncaught exception"推送 View Controller 时崩溃

cocoa - 新的 "iOS data protection APIs"是什么?

ios - 如何知道 super View 层次结构

iphone - iOS 应用程序启动时崩溃

iphone - iOs 将我的当前屏幕添加到电子邮件

Android:设置工具栏主题会导致应用崩溃