xxxAIRINxxx / ViewPagerController

Infinite menu & view paging Controller. written in Swift.
MIT License
79 stars 17 forks source link

Could not dismiss ViewPagerController #7

Open bhaumikdesai91 opened 8 years ago

bhaumikdesai91 commented 8 years ago

Hey there awesome work thanks for making this, I am running into this issue I am actively looking for solutions but I couldn't find one so can you please take a look at this:

simulator screen shot 15-oct-2016 6 21 24 am

I just added a close button to dismiss the view controller in NavSampleViewController.swift of your demo. following is the code:

`self.navigationItem.leftBarButtonItem = UIBarButtonItem(title: "close", style: .Plain, target: self, action: #selector(popThis))

func popThis() { self.navigationController!.dismissViewControllerAnimated(false, completion: nil) }`

And the app crashes showing following error: Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'An instance 0x7fc603014400 of class UITableView was deallocated while key value observers were still registered with it. Current observation info: <NSKeyValueObservationInfo 0x60800002b980> ( <NSKeyValueObservance 0x60800005bf30: Observer: 0x7fc600c04200, Key path: contentOffset, Options: <New: YES, Old: YES, Prior: NO> Context: 0x0, Property: 0x60800005f650> )' *** First throw call stack: ( 0 CoreFoundation 0x000000010993934b __exceptionPreprocess + 171 1 libobjc.A.dylib 0x000000010939a21e objc_exception_throw + 48 2 CoreFoundation 0x00000001099a2265 +[NSException raise:format:] + 197 3 Foundation 0x0000000108ed0451 NSKVODeallocate + 293 4 ViewPagerController 0x0000000108df673e _TToFC19ViewPagerController19ViewPagerControllerE + 526 5 libobjc.A.dylib 0x0000000109398a0a _ZL27object_cxxDestructFromClassP11objc_objectP10objc_class + 127 6 libobjc.A.dylib 0x00000001093a44de objc_destructInstance + 129 7 libobjc.A.dylib 0x00000001093a4510 object_dispose + 22 8 UIKit 0x0000000109f73a72 -[UIResponder dealloc] + 146 9 UIKit 0x0000000109efacc9 -[UIViewController dealloc] + 1920 10 ViewPagerController 0x0000000108df649c _TFC19ViewPagerController19ViewPagerControllerD + 108 11 ViewPagerController 0x0000000108df6522 _TToFC19ViewPagerController19ViewPagerControllerD + 34 12 Demo 0x0000000108d18fad _TToFC4Demo23NavSampleViewControllerE + 61 13 libobjc.A.dylib 0x0000000109398a0a _ZL27object_cxxDestructFromClassP11objc_objectP10objc_class + 127 14 libobjc.A.dylib 0x00000001093a44de objc_destructInstance + 129 15 libobjc.A.dylib 0x00000001093a4510 object_dispose + 22 16 UIKit 0x0000000109f73a72 -[UIResponder dealloc] + 146 17 UIKit 0x0000000109efacc9 -[UIViewController dealloc] + 1920 18 CoreFoundation 0x000000010999020e common_removeAllObjects + 254 19 CoreFoundation 0x000000010986d8c3 -[__NSArrayM dealloc] + 19 20 libobjc.A.dylib 0x00000001093aeb12 _ZN11objc_object17sidetable_releaseEb + 212 21 UIKit 0x0000000109efac95 -[UIViewController dealloc] + 1868 22 UIKit 0x0000000109f28ca6 -[UINavigationController dealloc] + 420 23 UIKit 0x0000000109ee23e4 -[UIPresentationController .cxx_destruct] + 262 24 libobjc.A.dylib 0x0000000109398a0a _ZL27object_cxxDestructFromClassP11objc_objectP10objc_class + 127 25 libobjc.A.dylib 0x00000001093a44de objc_destructInstance + 129 26 libobjc.A.dylib 0x00000001093a4510 object_dispose + 22 27 UIKit 0x0000000109edd968 -[UIPresentationController dealloc] + 56 28 UIKit 0x000000010a7c1b1a -[_UIFullscreenPresentationController dealloc] + 56 29 libobjc.A.dylib 0x00000001093aeb12 _ZN11objc_object17sidetable_releaseEb + 212 30 UIKit 0x0000000109edd68d __destroy_helper_block_.433 + 24 31 libsystem_blocks.dylib 0x000000010d3e2952 _Block_release + 102 32 UIKit 0x000000010a8a30c2 -[_UIViewControllerTransitionContext .cxx_destruct] + 94 33 libobjc.A.dylib 0x0000000109398a0a _ZL27object_cxxDestructFromClassP11objc_objectP10objc_class + 127 34 libobjc.A.dylib 0x00000001093a44de objc_destructInstance + 129 35 libobjc.A.dylib 0x00000001093a4510 object_dispose + 22 36 UIKit 0x000000010a8a18a6 -[_UIViewControllerTransitionContext dealloc] + 56 37 UIKit 0x000000010a8a3168 -[_UIViewControllerOneToOneTransitionContext dealloc] + 79 38 libobjc.A.dylib 0x00000001093aeb12 _ZN11objc_object17sidetable_releaseEb + 212 39 libsystem_blocks.dylib 0x000000010d3e2952 _Block_release + 102 40 UIKit 0x0000000109e16c05 -[UIViewAnimationBlockDelegate .cxx_destruct] + 43 41 libobjc.A.dylib 0x0000000109398a0a _ZL27object_cxxDestructFromClassP11objc_objectP10objc_class + 127 42 libobjc.A.dylib 0x00000001093a44de objc_destructInstance + 129 43 libobjc.A.dylib 0x00000001093a4510 object_dispose + 22 44 libobjc.A.dylib 0x00000001093aeb12 _ZN11objc_object17sidetable_releaseEb + 212 45 Foundation 0x0000000108ec33c5 __delayedPerformCleanup + 50 46 CoreFoundation 0x00000001098cbce6 CFRunLoopTimerInvalidate + 630 47 CoreFoundation 0x00000001098cb62a __CFRunLoopDoTimer + 1130 48 CoreFoundation 0x00000001098cb17a __CFRunLoopDoTimers + 250 49 CoreFoundation 0x00000001098c2f01 __CFRunLoopRun + 2065 50 CoreFoundation 0x00000001098c2494 CFRunLoopRunSpecific + 420 51 GraphicsServices 0x000000010f24fa6f GSEventRunModal + 161 52 UIKit 0x0000000109d5cf34 UIApplicationMain + 159 53 Demo 0x0000000108d1a3c2 main + 114 54 libdyld.dylib 0x000000010d39c68d start + 1 ) libc++abi.dylib: terminating with uncaught exception of type NSException

Also it seems to be crashing at the following line of the ViewPagerController.swift :

deinit { self.scrollViewObservingType = .none }

bhaumikdesai91 commented 8 years ago

If you are interested in solving this, I would like to help.

rockylive commented 5 years ago

What is the solution for the crash?

samaradhjain01-ops commented 4 years ago

If you are interested in solving this, I would like to help Hello Bhaumik Desai, I am also stuck in same problem, Can you please suggest a bit.