ios - How to debug bad access code 2 error -


my ios app crashing @ point in application. can reproduce crash every time. cannot figure out why crashing. ran profiler , checked zombies - none found.

it crashes in 2 places first place method:

    -(void)toolbarhidden:(bool)hidden {     self.toolbar.clipstobounds = yes;      if (!hidden){      self.toolbar.hidden = no;         self.toolbarheightcontraint.constant = 35;         self.toolbarbottomcontraint.constant = 0;           [uiview animatewithduration:0.5                               delay:0              usingspringwithdamping:0.5               initialspringvelocity:0.5                             options:0                          animations:^{                               [self.view layoutsubviews];                           } completion:nil];     }else     {     self.toolbar.hidden = yes;         self.toolbarheightcontraint.constant = 1;         self.toolbarbottomcontraint.constant = 0;         [uiview animatewithduration:0.5                               delay:0              usingspringwithdamping:0.5               initialspringvelocity:0.5                             options:0                          animations:^{                              //                              [self.view layoutsubviews];                           } completion:nil];       } } 

at link:

        self.toolbar.hidden = no; 

if comment out - breakpoint stops @ next line when app crashes again.

if comment method out completely, app crashes in similar method, right below has code:

    -(void)shouldmovecollectionviewdown:(bool)move {     uiedgeinsets insetdown = uiedgeinsetsmake(41, 0, 0, 0);     uiedgeinsets insetup = uiedgeinsetsmake(0, 0, 0, 0);      if (move){         self.scrollbarview.hidden = no;          [self.tradefeedcollectionview setcontentinset:insetdown];     }else {         self.scrollbarview.hidden = yes;         [self.tradefeedcollectionview setcontentinset:insetup];     } } 

at line:

            self.scrollbarview.hidden = no; 

this driving me nuts.

if comment both methods out. no crashes.

can me , point me in right direction. else can debug crash?

edit

this console says. reason didn't add earlier question due seeing error few times during app runtime , hasn't causes issue. think it's related though - however, have no idea how fix it.

unable simultaneously satisfy constraints. @ least 1 of constraints in following list 1 don't want. try this: (1) @ each constraint , try figure out don't expect; (2) find code added unwanted constraint or constraints , fix it. (note: if you're seeing nsautoresizingmasklayoutconstraints don't understand, refer documentation uiview property translatesautoresizingmaskintoconstraints) ( "", "", "", "" )

will attempt recover breaking constraint

break on objc_exception_throw catch in debugger. methods in uiconstraintbasedlayoutdebugging category on uiview listed in may helpful.

here screen shot of error , top part of stack trace:

enter image description here

your stacktrace seems indicate infinite loop, 1 of methods called (maybe inside delegate scrollviewdidscroll) leads recursion. crashes prevent computer freezing.

to debug this:

  • put breakpoint @ beginning of method, , continue execution see come @ same place each time,
  • then, try determine in part of delegate there code triggers again.

for example, setting inset might invalidate layout, redraw , reposition scroll @ previous location, leading unintentional trigger of delegate.

note complain constraints not being satisfied involved code, it's not raise exception. it's still error, , might lead unexpected layout.


Comments

Popular posts from this blog

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

javascript - How to name a jQuery function to make a browser's back button work? -