John-Lluch / SWRevealViewController

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

When I try to present modal controller on iOS7 in crashes #309

Closed endore8 closed 10 years ago

endore8 commented 10 years ago

After I enabled zombie: -[NSISRestrictedToNonNegativeVariable retain]: message sent to deallocated instance 0x176c5090

This crash was appeared for the first time when I decided to integrate this library.

John-Lluch commented 10 years ago

Is this related with SWRevealViewController?, are you using ARC?

endore8 commented 10 years ago

yes, it is and yes I'm using ARC.

John-Lluch commented 10 years ago

I don't even know what NSISRestrictedToNonNegativeVariable is. Any hints on what should I look at (in relation to SWRevealViewController)?

Thanks.

endore8 commented 10 years ago

I don't have any ideas why it happens. Maybe it depends on some animation? Only similar issue that I've found is related to uiimagepickercontroller, but I don't use it in my app. http://stackoverflow.com/questions/19578080/presenting-the-uiimagepickercontroller-causes-a-crash-on-ios-7

endore8 commented 10 years ago

Also, at start after init in storyboard it presents modal controller well, it crashes after I called pushFrontViewController method.

John-Lluch commented 10 years ago

closing this based on #107

prefect42 commented 10 years ago

@Endore8 Could you get rid of this error? I have the exact problem when dismissing a modal view controller. Did not get it in the past. Did not change my code. Only thing I did was update SWRevealViewController.

bsachetta commented 9 years ago

I'm seeing this issue on iOS 7 as well. Was anyone able to fix it?

mark-tussock commented 9 years ago

I am also having this issue - Anyone found a work around or fix?

I only see it in ios 7

@prefect42 @bsachetta @Endore8

bsachetta commented 9 years ago

I've got nothing at the moment. Looked into it for a couple hours the other day but even turning on zombies in xcode isn't that helpful. I also took at look at #107 and think that this is still relevant since it's a crash specific to this repo.

mark-tussock commented 9 years ago

@bsachetta, this is definitely caused by SWReveal, I have switched to using MMDrawerController and all the crashes are gone. There is a UIviewcontroller category available to help get it working with story board. good luck!

bsachetta commented 9 years ago

@mark-tussock after much deliberation, we finally moved to MMDrawerController. Thanks for the tip.

John-Lluch commented 9 years ago

Can anyone describe what exact setup causes the class to crash? The posts above are all very unespecific. I am unable to reproduce any crash so it's impossible for me to fix anything. Thanks.

bsachetta commented 9 years ago

It is somewhat sporadic, but the most consistent way my team and I could crash this was on iOS 7. Somewhat regularly, when dismissing a modal view controller, the app would crash. When I turned on zombie objects in xcode, this is what the system told me was the reason for the crash: [NSISRestrictedToNonNegativeVariable retain]. Not horribly informative, unfortunately.

John-Lluch commented 9 years ago

How is the modal view controller related with the reveal controller? Are you presenting a reveal controller in a modal controller maybe?

bsachetta commented 9 years ago

Sorry, John, I don't exactly know. We are setting the top / center view controller to be a view controller instance and then presenting a modal on top of it like this:

[self presentViewController:navigationController animated:YES completion:nil];

dominikoledzki commented 9 years ago

@John-Lluch I am experiancing the same problem with error: -[NSISRestrictedToNonNegativeVariable retain]: message sent to deallocated instance. Maybe this will give you a bit more insight in the problem.

Callstack of the crashed thread looks like that:

0 libobjc.A.dylib 0x394bd626 objc_msgSend + 6 1 CoreFoundation 0x2ec56576 -[NSSetM addObject:] + 278 2 Foundation 0x2f683d88 -[NSISLinearExpression enumerateVariables:] + 40 3 Foundation 0x2f683d52 -[NSISEngine setRowWithHead:body:] + 98 4 Foundation 0x2f682f62 -[NSISEngine tryAddingDirectly:] + 162 5 Foundation 0x2f6827be -[NSISEngine tryToAddConstraintWithMarker:expression:integralizationAdjustment:mutuallyExclusiveConstraints:] + 610 6 Foundation 0x2f68244a -[NSLayoutConstraint _addLoweredExpression:toEngine:integralizationAdjustment:lastLoweredConstantWasRounded:mutuallyExclusiveConstraints:] + 278 7 Foundation 0x2f680168 -[NSLayoutConstraint _addToEngine:integralizationAdjustment:mutuallyExclusiveConstraints:] + 224 8 UIKit 0x3163a258 -[UIView(UIConstraintBasedLayout) _layoutEngine_didAddLayoutConstraint:roundingAdjustment:mutuallyExclusiveConstraints:] + 364 9 UIKit 0x316415a4 -[UIView(UIConstraintBasedLayout) _constraints_didChangeAutoresizingConstraintsArrayForContainedView:] + 192 10 UIKit 0x3163a8e8 -[UIView(UIConstraintBasedLayout) _updateAutoresizingConstraints] + 108 11 UIKit 0x3163a828 -[UIView(AdditionalLayoutSupport) updateConstraints] + 116 12 UIKit 0x31ad62e6 -[UIView(AdditionalLayoutSupport) _internalUpdateConstraintsIfNeededAccumulatingViewsNeedingSecondPass:] + 242 13 UIKit 0x3163e226 -[UIView(AdditionalLayoutSupport) _updateConstraintsIfNeededAccumulatingViewsNeedingSecondPass:] + 122 14 CoreFoundation 0x2ec4c156 CFArrayApplyFunction + 34 15 UIKit 0x31ad6280 -[UIView(AdditionalLayoutSupport) _internalUpdateConstraintsIfNeededAccumulatingViewsNeedingSecondPass:] + 140 16 UIKit 0x3163e226 -[UIView(AdditionalLayoutSupport) _updateConstraintsIfNeededAccumulatingViewsNeedingSecondPass:] + 122 17 CoreFoundation 0x2ec4c156 CFArrayApplyFunction + 34 18 UIKit 0x31ad6280 -[UIView(AdditionalLayoutSupport) _internalUpdateConstraintsIfNeededAccumulatingViewsNeedingSecondPass:] + 140 19 UIKit 0x3163e226 -[UIView(AdditionalLayoutSupport) _updateConstraintsIfNeededAccumulatingViewsNeedingSecondPass:] + 122 20 Foundation 0x2f67fd30 -[NSISEngine withBehaviors:performModifications:] + 208 21 UIKit 0x316580c2 -[UIWindow(UIConstraintBasedLayout) updateConstraintsIfNeeded] + 214 22 UIKit 0x3155f3a4 -[UIView(Hierarchy) layoutBelowIfNeeded] + 332 23 UIKit 0x315f95f2 -[UINavigationController _layoutViewController:] + 806 24 UIKit 0x315f6780 -[UINavigationController _updateBarsForCurrentInterfaceOrientation] + 96 25 UIKit 0x315c225a -[UIViewController viewDidMoveToWindow:shouldAppearOrDisappear:] + 662 26 UIKit 0x315f6582 -[UINavigationController viewDidMoveToWindow:shouldAppearOrDisappear:] + 62 27 UIKit 0x31549ca4 -[UIView(Internal) _didMoveFromWindow:toWindow:] + 1244 28 UIKit 0x31549a80 -[UIView(Internal) _didMoveFromWindow:toWindow:] + 696 29 UIKit 0x31549a80 -[UIView(Internal) _didMoveFromWindow:toWindow:] + 696 30 UIKit 0x31549a80 -[UIView(Internal) _didMoveFromWindow:toWindow:] + 696 31 UIKit 0x31549a80 -[UIView(Internal) _didMoveFromWindow:toWindow:] + 696 32 UIKit 0x315493e8 45-[UIView(Hierarchy) _postMovedFromSuperview:]_block_invoke + 108 33 Foundation 0x2f67fd30 -[NSISEngine withBehaviors:performModifications:] + 208 34 UIKit 0x3154926c -[UIView(Hierarchy) _postMovedFromSuperview:] + 292 35 UIKit 0x31555ff8 -[UIView(Internal) _addSubview:positioned:relativeTo:] + 1408 36 UIKit 0x31555a6e -[UIView(Hierarchy) addSubview:] + 26 37 UIKit 0x3163753e -[UITransitionView transition:fromView:toView:removeFromView:] + 974 38 UIKit 0x31637152 -[UIViewControllerBuiltinTransitionViewAnimator animateTransition:] + 446 39 UIKit 0x31636bbc __101-[UIWindowController transition:fromViewController:toViewController:target:didEndSelector:animation:]_block_invoke_2 + 1268 40 UIKit 0x315c9de6 _applyBlockToCFArrayCopiedToStack + 314 41 UIKit 0x31542b32 _afterCACommitHandler + 426 42 CoreFoundation 0x2ece3ff6 CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION + 18 43 CoreFoundation 0x2ece1982 CFRunLoopDoObservers + 282 44 CoreFoundation 0x2ece1cce CFRunLoopRun + 734 45 CoreFoundation 0x2ec4c724 CFRunLoopRunSpecific + 520 46 CoreFoundation 0x2ec4c506 CFRunLoopRunInMode + 102 47 GraphicsServices 0x33bbb6ce GSEventRunModal + 134 48 UIKit 0x315ad86c UIApplicationMain + 1132 49 xxxxxxxx 0x004d60e6 0xc3000 + 4272358 50 libdyld.dylib 0x399b1ab4 start + 0

So I think it is related to autolayout.

I cannot provide code but my configuration looks like that: RevealVC is a root view controller of key window with some front view controller and menu. When option in menu is selected I create UINavigationController with some root view controller and use pushFrontViewController method of SWRevealViewController. After that I typically push some more view controllers on navigation stack. Afterwards I present some view controller (from the top VC on the stack) and when I call dismissViewController on presenting view controller application crashes.

Crash occurs on call to dismiss method, before any animation or interface change.

ghost commented 9 years ago

hello john.

encountered this issue as well. only occurred when a modal (UIImagePickerController) was presented/dismissed over view controllers (in a UINavigationController stack) which set self.navigationController?.navigationBarHidden in viewWillAppear or viewWillDisappear. crash still occurred when using self.navigationController?.setNavigationBarHidden(). managed to avoid by setting self.navigationController?.navigationBar.hidden instead. dunno if this information helps, but hope it does.

thanks a butt ton, class has been helpful, hope you're well.