2014-10-08 94 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