Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I am using collection view and getting a crash in ios 7 but it's working fine above 7. Getting crash after the line: [self dismissViewControllerAnimated:YES completion:nil];

the error message here:

*** Assertion failure in -[UICollectionView layoutSublayersOfLayer:], /SourceCache/UIKit_Sim/UIKit-2935.137/UIView.m:8794

*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Auto Layout still required after executing -layoutSubviews. UICollectionView's implementation of -layoutSubviews needs to call super.'

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
186 views
Welcome To Ask or Share your Answers For Others

1 Answer

*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Auto Layout still required after executing -layoutSubviews. UICollectionView's implementation of -layoutSubviews needs to call super.'

This error has very useful information. Ensure that, in your collection view, you are calling layoutSubviews on super and there is no code after that.

- (void)layoutSubviews {
  // Your Custom Code

  [super layoutSubviews]; // No code after this and this is called last
}

You can try creating a custom UICollectionView and enforcing call to layoutSubviews on super something like this:

@interface MyCollectionView : UICollectionView

@end

@implentation MyCollectionView

- (void)layoutSubviews {
    // Your Custom Code

    [super layoutSubviews];
}

@end

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...