John-Lluch / SWRevealViewController

A UIViewController subclass for presenting side view controllers inspired on the FaceBook and Wunderlist apps, done right !
Other
4.52k stars 989 forks source link

Error when selecting item from side tableView #700

Open junaidxabd opened 7 years ago

junaidxabd commented 7 years ago

It worked fine for me for a while but now I keep getting the error "libc++abi.dylib: terminating with uncaught exception of type NSException" when I click an item from the tableview. It'll show the next view then crash with that error. (I'm using swift 3)

Here's the console.

2017-05-20 19:47:56.677 TDA[6846:63482] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'An instance 0x7f84d4d09af0 of class UIScrollViewPanGestureRecognizer was deallocated while key value observers were still registered with it. Current observation info: <NSKeyValueObservationInfo 0x608000030ba0> (
<NSKeyValueObservance 0x60800005f320: Observer: 0x60800005eba0, Key path: state, Options: <New: YES, Old: NO, Prior: NO> Context: 0x0, Property: 0x60800005f3e0>
)'
*** First throw call stack:
(
    0   CoreFoundation                      0x000000010775bb0b __exceptionPreprocess + 171
    1   libobjc.A.dylib                     0x00000001071c0141 objc_exception_throw + 48
    2   CoreFoundation                      0x00000001077c4625 +[NSException raise:format:] + 197
    3   Foundation                          0x0000000106cfb9d3 NSKVODeallocate + 294
    4   libobjc.A.dylib                     0x00000001071d4b8e _ZN11objc_object17sidetable_releaseEb + 202
    5   CoreFoundation                      0x00000001077b22ad common_removeAllObjects + 189
    6   UIKit                               0x00000001054a1738 -[UIView(UIViewGestures) removeAllGestureRecognizers] + 430
    7   UIKit                               0x0000000105473e6a -[UIView dealloc] + 1524
    8   UIKit                               0x00000001054aeba0 -[UIScrollView dealloc] + 833
    9   UIKit                               0x0000000105d08879 -[UICollectionView dealloc] + 753
    10  Foundation                          0x0000000106cfb90d NSKVODeallocate + 96
    11  UIKit                               0x0000000105dd2f6e -[_UIViewControllerCompatibilityPreviewingContext .cxx_destruct] + 58
    12  libobjc.A.dylib                     0x00000001071be9bc _ZL27object_cxxDestructFromClassP11objc_objectP10objc_class + 127
    13  libobjc.A.dylib                     0x00000001071cad34 objc_destructInstance + 129
    14  libobjc.A.dylib                     0x00000001071cad66 object_dispose + 22
    15  libobjc.A.dylib                     0x00000001071d4b8e _ZN11objc_object17sidetable_releaseEb + 202
    16  CoreFoundation                      0x00000001077b22ad common_removeAllObjects + 189
    17  CoreFoundation                      0x00000001076933d3 -[__NSArrayM dealloc] + 19
    18  libobjc.A.dylib                     0x00000001071d4b8e _ZN11objc_object17sidetable_releaseEb + 202
    19  UIKit                               0x00000001055a65cf -[UIViewController .cxx_destruct] + 413
    20  libobjc.A.dylib                     0x00000001071be9bc _ZL27object_cxxDestructFromClassP11objc_objectP10objc_class + 127
    21  libobjc.A.dylib                     0x00000001071cad34 objc_destructInstance + 129
    22  libobjc.A.dylib                     0x00000001071cad66 object_dispose + 22
    23  UIKit                               0x00000001055f46d1 -[UIResponder dealloc] + 145
    24  UIKit                               0x000000010557e97a -[UIViewController dealloc] + 1846
    25  UIKit                               0x0000000105d4e3f5 -[UICollectionViewController dealloc] + 123
    26  CoreFoundation                      0x00000001077b22ad common_removeAllObjects + 189
    27  CoreFoundation                      0x00000001076933d3 -[__NSArrayM dealloc] + 19
    28  libobjc.A.dylib                     0x00000001071d4b8e _ZN11objc_object17sidetable_releaseEb + 202
    29  UIKit                               0x000000010557e94d -[UIViewController dealloc] + 1801
    30  UIKit                               0x00000001055abb10 -[UINavigationController dealloc] + 419
    31  CoreFoundation                      0x000000010769983d -[__NSArrayI dealloc] + 77
    32  libobjc.A.dylib                     0x00000001071d4b8e _ZN11objc_object17sidetable_releaseEb + 202
    33  UIKit                               0x00000001053eb97e _runAfterCACommitDeferredBlocks + 713
    34  UIKit                               0x00000001053d87bc _cleanUpAfterCAFlushAndRunDeferredBlocks + 532
    35  UIKit                               0x000000010540a28c _afterCACommitHandler + 137
    36  CoreFoundation                      0x0000000107701717 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
    37  CoreFoundation                      0x0000000107701687 __CFRunLoopDoObservers + 391
    38  CoreFoundation                      0x00000001076e6720 __CFRunLoopRun + 1200
    39  CoreFoundation                      0x00000001076e6016 CFRunLoopRunSpecific + 406
    40  GraphicsServices                    0x000000010ada9a24 GSEventRunModal + 62
    41  UIKit                               0x00000001053df0d4 UIApplicationMain + 159
    42  TDA                                 0x0000000103872797 main + 55
    43  libdyld.dylib                       0x0000000109c4a65d start + 1
    44  ???                                 0x0000000000000002 0x0 + 2
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)  
iDevelopper commented 7 years ago

You have an observer to remove in the previous view controller.

ulisescarreonalvarez commented 7 years ago

@iDevelopper how can we do that? :D

parthjdabhi commented 7 years ago

Getting same issue (Fatal Exception: NSInternalInconsistencyException) Using SWRevealViewController in Swift 2.2 fabric issue 1

akshay1318a commented 7 years ago

Ya I told u there she serious prob here!!:(

On 22-Jun-2017, at 3:59 PM, Parth Dabhi (iOS & Android developer) notifications@github.com wrote:

Getting same issue (Fatal Exception: NSInternalInconsistencyException) Using SWRevealViewController in Swift 2.2 https://user-images.githubusercontent.com/10777063/27429631-5770bdd6-5763-11e7-9a43-4f21a6921354.png — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/John-Lluch/SWRevealViewController/issues/700#issuecomment-310341515, or mute the thread https://github.com/notifications/unsubscribe-auth/AbxZ9d28Ll8B9P-6_hr8LEAlOM-f63o-ks5sGkIegaJpZM4NhXjG.

iDevelopper commented 7 years ago

Probably an observer to remove:

        [yourObject removeObserver:self forKeyPath:@"yourKeyPath"];
akshay1318a commented 7 years ago

What Is a key path???what should I use there?

On 22-Jun-2017, at 5:29 PM, Patrick notifications@github.com wrote:

Probably an observer to remove:

    [yourObject removeObserver:self forKeyPath:@"yourKeyPath"];

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/John-Lluch/SWRevealViewController/issues/700#issuecomment-310359375, or mute the thread https://github.com/notifications/unsubscribe-auth/AbxZ9dftY6NNEIKus0Xet3W-7HqYaU7dks5sGlc7gaJpZM4NhXjG.

iDevelopper commented 7 years ago

https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/KeyValueObserving/Articles/KVOBasics.html

parthjdabhi commented 7 years ago

Hey @iDevelopper [Patrick], yes but which observer is not removing that is difficult to identify, and this issue arises in some random case not from same identified pattern otherwise I can test that flow.

iDevelopper commented 7 years ago

Search for the keyword addObserver in your project!

parthjdabhi commented 7 years ago

i found couple of the observer in SWReavelviewcontroller, but how to know which one is buggy and in which case is not removing?

iDevelopper commented 7 years ago

There is not observer in SW

iDevelopper commented 7 years ago

Could you upload your project here?