2014-10-08 89 views
2

IOS 8对方向变化的碰撞....IOS 8有崩溃的方向变化

首先我们显示的报告像这里..

-(void)didShowReport:(NSString *)fileName andFlag:(BOOL) isWeightReport 
{ 
    UIStoryboard *storyBoard = [UIStoryboard storyboardWithName:@"Document_Picker" bundle:nil]; 
    UINavigationController *nav = [storyBoard instantiateViewControllerWithIdentifier:@"reportNav"]; 
    NSLog(@"topviewcontrolle - %@",[nav topViewController]); 
    SSReportPreviewViewController *reportPreview = (SSReportPreviewViewController *) [nav topViewController]; 
    reportPreview.fileName = fileName; 
    //reportPreview.delegate = self; 
    reportPreview.title = [fileName lastPathComponent]; 
    if(isWeightReport) 
     reportPreview.mailSubject = NSLocalizedString(@"weightsummaryreport", @""); 
    else 
     reportPreview.mailSubject = NSLocalizedString(@"pricesummaryreport", @""); 


    [nav setModalTransitionStyle:UIModalTransitionStyleFlipHorizontal]; 
    [self presentViewController:nav animated:YES completion:nil]; 
} 

在这之后,我们取消该视图使用

- (IBAction)onCancel:(id)sender {  
    [self dismissViewControllerAnimated:YES completion:nil]; 
} 

取消我们旋转....碰撞发生后控制器....

ERR或显示.....如下所示

*** -[UINavigationController _viewControllerForSupportedInterfaceOrientationsWithDismissCheck:]: message sent to deallocated instance 0x16ad08c0 

回答

1

您是否在用户按下操作表单中的按钮之后呈现此内容? (或者可能是一个警报视图?)

iOS 8现在在自己的窗口中显示操作表。 (从应用程序委托中检查哪个窗口是关键的。)如果在窗口被取消之前显示模式,模式将从操作表窗口呈现(或至少从其中引用并在旋转过程中引用)。

尝试使用didDismissWithButtonIndex:而不是willDismissWithButtonIndex:。 如果这不起作用,请尝试用0.1或0.2秒的延迟调度您的演示文稿。 (有时只是调度到主队列,以给出一个运行循环延迟就足够了。)

+0

我们调用它在表视图做选择索引方法....从那里我们调用委托方法,以便委托(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewCell * cell = [self.tableView cellForRowAtIndexPath:indexPath]; NSString * file = [self.delegate didSelectedWithReportType:cell.textLabel.text]; [self.delegate didShowReport:file withTitle:NSLocalizedString(@“MaintenanceReport”,@“”)]; } – 2014-10-08 07:33:07

+0

这是在IOS 7上完美工作,但在IOS 8中只有这个问题......在一个表视图didselect方法中,我们调用了一个委托[self.delegate didShowReport:file withTitle:NSLocalizedString(@“MaintenanceReport “,@”“)];里面这个didshowreport方法这个视图控制器正在呈现.... – 2014-10-08 07:38:05

+0

谢谢!这解决了我的问题。我正在使用'actionSheet:clickedButtonAtIndex:'将一个'UINavigationController'呈现为模式,这导致方向更改事件使我的应用崩溃。按照这个答案中的建议,我将它改为'didDismissWithButtonIndex:'。 – 2014-11-03 08:08:40