我正在显示一个MFMailComposeViewController,如下所示:
- (IBAction) contactUs: (id) sender {
[Tracker trackContactUsPressed: [MFMailComposeViewController canSendMail]];
if ([MFMailComposeViewController canSendMail] == NO) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle: @"Email Error"
message: @"Email has not been configured on this device. Please send us an email at\nFOO@BAR.com"
delegate: self
cancelButtonTitle: @"OK"
otherButtonTitles: nil];
[alert show];
[alert release];
} else {
MFMailComposeViewController *controller = [[[MFMailComposeViewController alloc] init] autorelease];
[controller setSubject:@"Comments about FOO"];
[controller setToRecipients: [NSArray arrayWithObject: @"FOO@BAR.com"]];
[controller setMailComposeDelegate: self];
[[self parentViewController] presentModalViewController:controller animated:YES];
}
}
Run Code Online (Sandbox Code Playgroud)
然后我的代表看起来像这样:
- …Run Code Online (Sandbox Code Playgroud) 下面的代码在iOS 4和5中运行良好,但在iOS 6中崩溃EXC_BAD_ACCESS.我很感激您在排除故障时提供帮助.在UITableViewController处理我的应用程序的搜索逻辑的过程中调用此代码:
CATransition *transition = [CATransition animation];
transition.duration = 0.3f;
transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear];
transition.type = kCATransitionFade;
[self.navigationController.view.layer addAnimation:transition forKey:nil];
[self.navigationController popViewControllerAnimated:NO];
Run Code Online (Sandbox Code Playgroud)
我添加的tableView方式类似,并且在调用时不会崩溃:
SearchTVC *searchTable = [[SearchTVC alloc] init];
searchTable.detailViewController = self.detailViewController;
CATransition *transition = [CATransition animation];
transition.duration = 0.3f;
transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear];
transition.type = kCATransitionFade;
[self.navigationController.view.layer addAnimation:transition forKey:nil];
[self.navigationController pushViewController:searchTable animated:NO];
Run Code Online (Sandbox Code Playgroud)
可能是什么问题呢?
*编辑
有趣的是,如果我使用[self.navigationController popViewControllerAnimated:YES];(YES而不是NO),则不会发生崩溃.但当然这会破坏使用自定义流行动画的目的.