views:

1302

answers:

1

My application on iphone quit with following console message when we try to play the animation with 100 images again and again.

Program received signal:  “0”.
warning: check_safe_call: could not restore current frame

So i want to know how can i remove this crash. Am I doing anything wrong using animation? Code follows:

catAnimationImageView.image = [UIImage imageNamed:@"SZ_Interior_Idle3_0.png"];

NSMutableArray *arr = [ [NSMutableArray alloc] initWithCapacity:114];
for(int iLoop = 0; iLoop < 114; iLoop++)
{
 [arr addObject:[UIImage imageNamed:[ NSString stringWithFormat:@"SZ_Interior_Idle3_%d.png",iLoop]]];
}
catAnimationImageView.animationImages = arr;

catAnimationImageView.animationDuration = 10;
catAnimationImageView.animationRepeatCount = 1;
catAnimationImageView.alpha = 1;
[[delegate getMidGroundView] addSubview:catAnimationImageView];
[arr release];

[catAnimationImageView startAnimating];
A: 
[arr release];

You are releasing your array of images before the animation starts.

mahboudz
Actually, catAnimationImageView.animationImages should be retaining the array. How do you repeat this over and over? Do you repeat all the same code again?
mahboudz
Actually there are five different different cat animation randomly so thats why we free the catanimationImageView on the end of the animation. and create the differnt animation sequence.
Santosh
I don't see where you free catAnimationImageView. Do you remove it from the superview first? Do you have 100 images for each of the 5 different animation sequences? 500 images total? How big is each image?
mahboudz
Animation duration is 10 seconds. After completing the animation I remove the catAnimationImageView from superview first and then release it. After some time again i create a animation with different images. This happens again and again. Each image is of size 4KB.
Santosh
I also tried to create the all animation object once and only set its alpha to zero. So its remove the overhead of creating the animation object again and again. But still i face the same problem.
Santosh