CoreAnimation call from UIKit causing mysterious crash

Moderator
Posts: 384
Joined: 2002.08
Post: #1
I have some basic animation in an iOS app I'm creating that has behaved completely fine... until yesterday.

I apparently made a change that somehow affected it, and I'm having trouble identifying what the issue is.

When stepping through the code, it gets to this chunk of code, and dies after stepping over the commitAnimation line (I originally wrote this before I realized the beauty of [UIView animateWithDuration: ...]:
Code:
            UIView *favoritesTabItemView = [appDelegate.tabBarController.tabBar viewWithTag:0];
            CGPoint startingPoint = [[magazineView superview] convertPoint:CGPointMake(magazineView.center.x, magazineView.center.y) toView:appDelegate.window.rootViewController.view];
            CGPoint targetPoint = CGPointMake(favoritesTabItemView.center.x - 214.0, favoritesTabItemView.center.y);
            
            
            //shrink the icon down
            UIGraphicsBeginImageContextWithOptions(magazineView.bounds.size, NO, 0.0);
            //UIGraphicsBeginImageContext(magazineView.bounds.size);
            [magazineView.layer renderInContext:UIGraphicsGetCurrentContext()];
            UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();
            UIGraphicsEndImageContext();
            
            [UIImageView beginAnimations:nil context:nil];
            [UIImageView setAnimationDuration:0.1];
            PublicationCoverImageReflectionView.alpha = 0.0;
            [UIImageView commitAnimations];

The error from the debugger after I step over commitAnimation is giving me very little help:
Code:
*** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayM objectAtIndex:]: index 9 beyond bounds [0 .. 8]'
*** First throw call stack:
(0x35c8b88f 0x31604259 0x35bd49db 0x126d5d 0x12e65f 0x349da6c9 0x34a66531 0x35c57547 0x35be3097 0x349da3eb 0x307a3a13 0x10f8ef 0x35be53fd 0x307a9faf 0x307a9f6b 0x307a9f49 0x307a9cb9 0x307aa5f1 0x307a8ad3 0x307a84c1 0x3078e83d 0x3078e0e3 0x3596122b 0x35c5f523 0x35c5f4c5 0x35c5e313 0x35be14a5 0x35be136d 0x35960439 0x307bce7d 0xbb109 0xbb0c8)
terminate called throwing an exception(lldb)

Does anyone know what kind of array this might be talking about? It is a UIKit call that it's dying on, so I'm thinking the array is some array of views used by UIKit, but that I have no visibility into...

Any ideas on how to address or even further investigate this would be great!

KB Productions, Car Care for iPhone/iPod Touch
@karlbecker_com
All too often, art is simply the loss of practicality.
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #2
A symbolicated backtrace would be useful, not just the hex addresses!
Quote this message in a reply
Moderator
Posts: 384
Joined: 2002.08
Post: #3
So... I will fully admit my stupidity and what I have learned.

When stack traces are not symbolicated, there are a LOT of ways to handle it... and I was not handling it all before. I was just going, "oh crap, I have no stack trace... shucks."

Thank you to this answer:
http://stackoverflow.com/questions/78416...stack-call

There's even a slick catch-all Exception Breakpoint in Xcode that can help a lot with problems like this.

With this knowledge, I should have no problem solving this.

So hopefully this thread can help even one newbie (of which I didn't consider myself.. until just now, ugh) know that undecipherable code stack traces in the Xcode debugger can be easily fixed!

KB Productions, Car Care for iPhone/iPod Touch
@karlbecker_com
All too often, art is simply the loss of practicality.
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Using threads to set a timeout on a connect() call SOUR-Monkey 6 7,486 Feb 13, 2005 09:59 PM
Last Post: ggadwa