Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash while scrolling into UITableView and going back on iOS 10. #73

Open
TheAbstractDev opened this issue Apr 25, 2018 · 7 comments
Open

Comments

@TheAbstractDev
Copy link

TheAbstractDev commented Apr 25, 2018

Hello,
I have a crash on iOS 10. while scrolling into UITableView and going back (from a navigation controller).

Error:

*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'An instance 0x7ff741828400 of class UITableViewWrapperView was deallocated while key value observers were still registered with it. Current observation info: <NSKeyValueObservationInfo 0x610000037b60> (
<NSKeyValueObservance 0x6100002581e0: Observer: 0x610000269e80, Key path: contentOffset, Options: <New: NO, Old: NO, Prior: NO> Context: 0x0, Property: 0x610000257400>

Looks like that you forget to remove observers (not setting them to nil) on ScrollViewUpdater.
You also forget to call deinit and remove observers on DeckPresentationController.

@TheAbstractDev
Copy link
Author

Here ... ?

@TheAbstractDev
Copy link
Author

TheAbstractDev commented Jun 20, 2018

@HarshilShah

Still alive ..?

@HarshilShah
Copy link
Owner

Hi there, and thanks for opening an issue to bring this to notice.

Your diagnosis isn’t quite correct, but this is an issue that needs some architectural changes to handle. I’ll be posting an RFC which goes into some changes soon.

Sent with GitHawk

@sejr
Copy link

sejr commented Nov 9, 2018

Hey @HarshilShah,

I seem to be experiencing some kind of similar issue with using this library with IGListKit. The error message is as follows:

2018-11-09 12:53:53.502557-0500 ... [CollectionView] An attempt to prepare a layout while a prepareLayout call was already in progress (i.e. reentrant call) has been ignored. Please file a bug. UICollectionView instance is (<UICollectionView: 0x12a001a00; frame = (0 0; 375 760); clipsToBounds = YES; gestureRecognizers = <NSArray: 0x2820745a0>; layer = <CALayer: 0x282e24980>; contentOffset: {0, 0}; contentSize: {0, 0}; adjustedContentInset: {0, 0, 34, 0}> collection view layout: <UICollectionViewFlowLayout: 0x129101190>)
2018-11-09 12:53:55.007733-0500 ... [CollectionView] An attempt to update layout information was detected while already in the process of computing the layout (i.e. reentrant call). This will result in unexpected behaviour or a crash. This may happen if a layout pass is triggered while calling out to a delegate. UICollectionViewFlowLayout instance is (<UICollectionViewFlowLayout: 0x129101190>)
2018-11-09 12:53:55.010652-0500 ... *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayM objectAtIndexedSubscript:]: index 2 beyond bounds [0 .. 1]'
*** First throw call stack:
(0x1f0bdbec4 0x1efdada40 0x1f0b53494 0x1f0ad6c88 0x21df45978 0x21df473f8 0x21df43698 0x21df446b8 0x1035bd5a0 0x1035bd48c 0x1035c2114 0x21ea7fbbc 0x21ea6ce68 0x21ea84590 0x21e254a24 0x21e70dcf0 0x21e249ffc 0x21e24a10c 0x21e249f80 0x21e675cb4 0x21e654fcc 0x21e64e3e0 0x21e64ec40 0x21e71e4f0 0x21e722634 0x21e72531c 0x21e71de0c 0x1f0b6c1f0 0x1f0b6c170 0x1f0b6ba54 0x1f0b66920 0x1f0b661f0 0x1fbadc368 0x1fbadf33c 0x1fbb2c3ec 0x1fbadf278 0x1034b9894 0x1034b9544 0x1034b2fd8 0x102e97518 0x102ea3ec8 0x102ea3f90 0x103603004 0x1035bec20 0x1035b4df8 0x21df45dc8 0x21df473f8 0x21df4124c 0x21df39a70 0x21df3a2b0 0x21df0e138 0x21eae1e18 0x1f5385028 0x1f5389fb8 0x1f52e9030 0x1f5317964 0x21e6628fc 0x1f0b6b7cc 0x1f0b66460 0x1f0b66a00 0x1f0b661f0 0x1f2ddd584 0x21e639934 0x102ea9a68 0x1f0626bb4)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb) 

This occurs when I quickly close the modal after having it appear. If you have any insight about this, or would like help, I am happy to contribute.

@adeelnoor
Copy link

@sejr Did you found the solution I am having the same issue in real devices with old iOS i.e. 11.x, but its working fine on simulator.

@leviduan
Copy link

@sejr @adeelnoor Did you found the solution I am having the same issue in real devices with old iOS i.e. 11.x, but its working fine on simulator. adeelnoor, can you resolve the question?

@adeelnoor
Copy link

adeelnoor commented Jul 17, 2019

Hello @leviduan

Yes please check below

protocol NibInstanceable {
    static func nibName() -> String
}

extension NibInstanceable where Self: UIView {

    /**
     Create and UIView and subclass instance from a nib in the Main bundle.

     Force un-wrap is used as early exception in case can not find a suitable instance.

     - Returns: Instance from nib resource.
     */
    static func nibInstance() -> Self {
        return Bundle.main.loadNibNamed(Self.nibName(), owner: nil, options: nil)?.first as! Self
    }
}
 
lazy var sampleCell = UITableViewCell.nibInstance() //Replace your cell class

And call this sampleCell where you want to call.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants