2017-01-23 3 views
1

セルフサイジングテーブルビュー内にコレクションビューがあります。ユーザーがコレクションビューをタップすると、別のビューが表示されます。iOS 'NSInternalInconsistencyException'、理由: 'UICollectionViewFlowLayout内部エラー

私はまだそのビューを縦向きに表示できます。しかし私が景色に回転すると、私はこのエラーが発生し、クラッシュします。どうすればいいですか?

2017年1月23日16:52:16.448417 SWEETミニ[1638:647130]で*アサーション 失敗 - [_ UIFlowLayoutSection computeLayoutInRect:forSection:無効:invalidationContext:]、 /BuildRoot /ライブラリ/キャッシュ/com.apple.xbs/Sources/UIKit/UIKit-3600.6.22/UIFlowLayoutSupport.m:823 2017-01-23 16:52:16.451537 SWEET Mini [1638:647130] *キャッチされていない例外のためアプリを終了する ' NSInternalInconsistencyException '、理由: ' UICollectionViewFlowLayout内部エラー '

このような別のビューを表示します。

- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath 
{ 
    MWPhotoBrowser *browser = [[MWPhotoBrowser alloc] initWithDelegate:self]; 
    browser.zoomPhotosToFill = NO; 
    [browser setCurrentPhotoIndex:(indexPath.row)]; 
    browser.enableSwipeToDismiss = YES; 
    UINavigationController *browseNav = [[UINavigationController alloc] initWithRootViewController:browser]; 

    if ([[AppDelegate instance].window.rootViewController isKindOfClass:[UINavigationController class]]) 
    { 
     UINavigationController *nav = (UINavigationController *) [AppDelegate instance].window.rootViewController; 
     [nav presentViewController:browseNav animated:YES completion:nil]; 
    } 
    else if ([[AppDelegate instance].window.rootViewController isKindOfClass:[UITabBarController class]]) { 
     UITabBarController *tab = (UITabBarController *) [AppDelegate instance].window.rootViewController; 
     [tab presentViewController:browseNav animated:YES completion:nil]; 
    } 
} 
+0

ビュー階層が壊れている可能性がありますか?なぜあなたは[self presentViewController:browseNav animated:YES completion:nil]を使わないのですか?別のVCを提示する? –

+0

coz私はNSObjectでそのコードを書いており、それはuiviewcontrollerからは遠いです。 (私はまだデリゲートでプッシュできます) –

+0

デリゲートで試しましたか?問題はまだ発生しますか? –

答えて

1

同じエラーメッセージで同じ問題が発生しました。それは、シミュレータ上でのみ起こっていることが分かります。実際のデバイスではすべて正常に動作します。

+2

私にとっては、それは逆でした。-012-しかし、https://stackoverflow.com/a/44467194/584405で解決しました。 – d4Rk

関連する問題