Pageboy icon indicating copy to clipboard operation
Pageboy copied to clipboard

When swiping too fast PageboyViewController crashes app

Open monolithic-adam opened this issue 7 years ago • 14 comments

Problem: When scrolling quickly the swipe registers as a touch causing me to present a ViewController over the pageboyviewcontroller. After dismissing the presented controller the pageboyviewcontroller is completely white. If you press the tab to move to another page twice it will crash with the error below.

PageboyViewController.swift line 389
specialized closure #2 in PageboyViewController.scrollToPage(_:animated:completion:

Fatal Exception: NSInternalInconsistencyException
Don't know about flushed view <UIView: 0x10676ef60; frame = (0 0; 414 672); autoresize = W+H; layer = <CALayer: 0x1d4030520>>
Fatal Exception: NSInternalInconsistencyException
0  CoreFoundation                 0x185cd1d04 __exceptionPreprocess
1  libobjc.A.dylib                0x184f20528 objc_exception_throw
2  CoreFoundation                 0x185cd1bd8 +[NSException raise:format:]
3  Foundation                     0x186661c24 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:]
4  UIKit                          0x18fa89460 -[UIPageViewController _flushViewController:animated:]
5  UIKit                          0x18fa8951c -[UIPageViewController queuingScrollView:didFlushView:animated:]
6  UIKit                          0x18fb7e7a8 -[_UIQueuingScrollView _flushView:animated:]
7  UIKit                          0x18fb7e934 -[_UIQueuingScrollView _replaceViews:updatingContents:adjustContentInsets:animated:]
8  UIKit                          0x18fb8122c -[_UIQueuingScrollView setView:direction:animated:completion:]
9  UIKit                          0x18fa85dac -[UIPageViewController _setViewControllers:withScrollInDirection:animated:completion:]
10 UIKit                          0x18fa85fe8 -[UIPageViewController setViewControllers:direction:animated:completion:]
11 Pageboy                        0x102e1dbc4 specialized closure #2 in PageboyViewController.scrollToPage(_:animated:completion:) (PageboyViewController.swift:389)
12 Pageboy                        0x102e1e890 partial apply for specialized  (PageboyViewController.swift)
13 Pageboy                        0x102e1bf58 thunk for @callee_owned () -> () (PageboyViewController.swift)
14 libdispatch.dylib              0x185655088 _dispatch_call_block_and_release
15 libdispatch.dylib              0x185655048 _dispatch_client_callout
16 libdispatch.dylib              0x185695dfc _dispatch_main_queue_callback_4CF$VARIANT$armv81
17 CoreFoundation                 0x185c79eb0 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__
18 CoreFoundation                 0x185c77a8c __CFRunLoopRun
19 CoreFoundation                 0x185b97fb8 CFRunLoopRunSpecific
20 GraphicsServices               0x187a2ff84 GSEventRunModal
21 UIKit                          0x18f16c2f4 UIApplicationMain
22 <Redacted>                      0x102490200 main (AppDelegate.swift:15)
23 libdyld.dylib                  0x1856ba56c start

monolithic-adam avatar Nov 01 '17 09:11 monolithic-adam

I second this and here's my stack trace:

PageboyViewController.swift line 389
PageboyViewControllerscrollToPageBoolPageboyViewController.Page first-element-marker Boolanimated empty-list UIViewController

Fatal Exception: NSInternalInconsistencyException
Don't know about flushed view <UIView: 0x133e4b570; frame = (0 0; 375 603); autoresize = W+H; layer = <CALayer: 0x1c4224000>>
Fatal Exception: NSInternalInconsistencyException
0  CoreFoundation                 0x182397d38 __exceptionPreprocess
1  libobjc.A.dylib                0x1818ac528 objc_exception_throw
2  CoreFoundation                 0x182397c0c +[NSException raise:format:]
3  Foundation                     0x182d26c24 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:]
4  UIKit                          0x18c11a09c -[UIPageViewController _flushViewController:animated:]
5  UIKit                          0x18c11a158 -[UIPageViewController queuingScrollView:didFlushView:animated:]
6  UIKit                          0x18c20d014 -[_UIQueuingScrollView _flushView:animated:]
7  UIKit                          0x18c20d1a0 -[_UIQueuingScrollView _replaceViews:updatingContents:adjustContentInsets:animated:]
8  UIKit                          0x18c20fa98 -[_UIQueuingScrollView setView:direction:animated:completion:]
9  UIKit                          0x18c1169e8 -[UIPageViewController _setViewControllers:withScrollInDirection:animated:completion:]
10 UIKit                          0x18c116c24 -[UIPageViewController setViewControllers:direction:animated:completion:]
11 Pageboy                        0x1005cd4a8 PageboyViewControllerscrollToPageBoolPageboyViewController.Page first-element-marker Boolanimated empty-list UIViewController (PageboyViewController.swift:389)
12 Pageboy                        0x1005ce174 PageboyViewControllerscrollToPageBoolPageboyViewController.Page first-element-marker Boolanimated empty-list UIViewController (PageboyViewController.swift)
13 Pageboy                        0x1005cb538 thunk (PageboyViewController.swift)
14 libdispatch.dylib              0x181d1d088 _dispatch_call_block_and_release
15 libdispatch.dylib              0x181d1d048 _dispatch_client_callout
16 libdispatch.dylib              0x181d29b74 _dispatch_main_queue_callback_4CF$VARIANT$mp
17 CoreFoundation                 0x18233ff20 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__
18 CoreFoundation                 0x18233dafc __CFRunLoopRun
19 CoreFoundation                 0x18225e2d8 CFRunLoopRunSpecific
20 GraphicsServices               0x1840eff84 GSEventRunModal
21 UIKit                          0x18b80b880 UIApplicationMain
22 AppName                        0x100033688 main (AppDelegate.swift:12)
23 libdyld.dylib                  0x181d8256c start

sasojadrovski avatar Nov 02 '17 08:11 sasojadrovski

@monolithic-adam @sasojadrovski thanks for all the detail, I am investigating this and hopefully will find a fix soon! It seems to have got a lot more prominent with iOS 11 😕

msaps avatar Nov 06 '17 10:11 msaps

@msaps,

Thank you for looking into it! Yeah, iOS 11 did things to us... Keep us posted 😊

Cheers, Sasho

sasojadrovski avatar Nov 06 '17 10:11 sasojadrovski

@sasojadrovski @monolithic-adam if you both check out 2.0.3 I've added some new logic which should fix the UIPageViewController crashing issues. Let me know how you get on! 👍

msaps avatar Nov 09 '17 21:11 msaps

Hey @msaps,

Thank you for looking into this so fast ⚡️ I really appreciate it! As far as I can tell from my initial testing, this issue seems to be resolved. Job well done!

Keep up the great work!

Cheers, Sasho

sasojadrovski avatar Nov 09 '17 21:11 sasojadrovski

Going to close this for now... will reopen if it comes back up for anyone.

msaps avatar Nov 24 '17 11:11 msaps

@msaps I am sorry for the late reply, but I still got the same crash with the lastest version of Tabman.

Using Pageboy (2.1.0)
Using PureLayout (3.0.2)
Using Tabman (1.1.1)

I have made a sample project here with the crash : https://github.com/JeromeCHA/TestTabman

JeromeCHA avatar Dec 04 '17 09:12 JeromeCHA

@JeromeCHA okay thanks, will take a look 👍

msaps avatar Dec 04 '17 10:12 msaps

@msaps Thank you for your prompt reply. The sample project I made has quite the same configuration as my current project. The crash happened when I scrolled fast to the left/right and I clicked accidentally on the tableviewCell and opened a viewController. When I pressed back, all the viewcontrollers are blank and a clicked on the paging menu make it crashed.

JeromeCHA avatar Dec 04 '17 10:12 JeromeCHA

@msaps Hi, I was wondering, it's been more than one month since the last update on this issue. Did you solve it?

JeromeCHA avatar Jan 16 '18 01:01 JeromeCHA

@JeromeCHA haven't looked into it lately, but will get back on it shortly!

Will prioritise it for v2.3.2 👍

msaps avatar Jan 16 '18 09:01 msaps

@JeromeCHA had a quick look.. I can't seem to reproduce the crash in the latest versions (Pageboy 2.3.1 & Tabman 1.4.0) on my iPhone X..

Attached is your demo project updated with the latest versions. Can you see if you can reproduce? (Might just be my slow fingers 😅)

TestTabman-master.zip

msaps avatar Jan 16 '18 15:01 msaps

@msaps Yes, I can still reproduce it 😕 You just have to swipe very fast to the left/right, and clic accidentally on a tableviewcell. This will push a ViewController. Going back, all pages are blank, and a clic on the tabbar will produce a crash.

JeromeCHA avatar Jan 18 '18 05:01 JeromeCHA

@JeromeCHA okay I'll check it out again 👍

msaps avatar Jan 21 '18 13:01 msaps