ios - Objective C, app crashes when changing root view controller. Orphaned without delegate (bug!) -
i've implemented dropdown menu ios app calls functions navigate between different storyboards. each element in menu calls following function in appdelegate class different storyboard name:
(void)changecontroller:(nsstring*)storyboardname { uistoryboard *storyboard = [uistoryboard storyboardwithname:storyboardname bundle:[nsbundle mainbundle]]; //initialize new view currentview = [storyboard instantiateinitialviewcontroller]; currentview.view.alpha = 0.0; currentview.view.frame = currentview.view.bounds; currentview.view.autoresizingmask = uiviewautoresizingflexiblewidth | uiviewautoresizingflexibleheight; //the app crashes on line thread 1: signal sigarbt message self.window.rootviewcontroller = currentview; [self.window makekeyandvisible]; //animate fade transition [uiview animatewithduration:transitionduration delay:0.0 options:uiviewanimationoptioncurvelinear animations:^{currentview.view.alpha = 1.0;} completion:^(bool finished){}]; } the problem function gets called crashes app inconsistently. works screens , not others. , worse, works on screens crashes on.
there 2 error messages dumped console, , (i've added line breaks readability):
objective: { objective 0x15e4b3c0: <750:-1.64135e-05> + <750:8.34465e-08> *<orphaned without delegate (bug!):0x1703c790>{id: 188} + <750:4.17233e-08> *<orphaned without delegate (bug!):0x1703c980>{id: 192} + <750:-2.68221e-08> *uiview:0x170c6e40.height{id: 1091} } and
uncaught exception: <nsisengine: 0x15e0b380>{ rows: uiwindow:0x15db3160.height{id: 140} == 960 + 1*0x15dd03e0.marker{id: 144} uiwindow:0x15db3160.width{id: 137} == 640 + 1*0x15dd03b0.marker{id: 141} uiwindow:0x15db3160.minx{id: 136} == 0 + 2*0x15dd0200.marker{id: 135} + -0.5*0x15dd03b0.marker{id: 141} uiwindow:0x15db3160.miny{id: 139} == 0 + 2*0x15dd0350.marker{id: 138} + -0.5*0x15dd03e0.marker{id: 144} objective{id: 1} == { objective 0x15e4b3c0: <750:-1.64135e-05> + <750:8.34465e-08> *<orphaned without delegate (bug!):0x1703c790>{id: 188} + <750:4.17233e-08> *<orphaned without delegate (bug!):0x1703c980>{id: 192} + <750:-2.68221e-08> *uiview:0x170c6e40.height{id: 1091}} constraints: <nsautoresizingmasklayoutconstraint:0x15dd03b0 h=--- v=--- h:[uiwindow:0x15db3160(320)]> marker:0x15dd03b0.marker{id: 141} <nsautoresizingmasklayoutconstraint:0x15dd03e0 h=--- v=--- v:[uiwindow:0x15db3160(480)]> marker:0x15dd03e0.marker{id: 144} <_uiwindowanchoringconstraint:0x15dd0200 h=--- v=--- uiwindow:0x15db3160.midx == + 160> marker:0x15dd0200.marker{id: 135} <_uiwindowanchoringconstraint:0x15dd0350 h=--- v=--- uiwindow:0x15db3160.midy == + 240> marker:0x15dd0350.marker{id: 138} integralization adjustments: (none) statistics: 4 rows. variable counts: 1 -> 2 2 -> 2 }: internal error. cannot find outgoing row head incoming head uiview:0x170c6e40.height{id: 1091}, should never happen. it's last line confuses me, "internal error .... should never happen."
i'm curious if else has encountered error, , how tackled it.
is issue initializing variable currentview, or perhaps appdelegate's window variable?
is issue storyboard constraints? , if so, there limit number of constraints can/should put on single screen?
edit:
i figured out error caused when navigating away 1 particular storyboard. constraint on screen throwing error. added code changecontroller: programmatically remove constraints every subview , remove every subview superview.
the problem resolved when constraints in offending uiviewcontroller cleared , recreated.
thanks , suggestions.
Comments
Post a Comment