我已经创建了一个数组来将我的 spriteFrame 放入其中,当然,我试图在使用它之后释放该数组,这样它就不会泄漏,但是每当我将它放在我的所有代码下面时,我的应用程序就会崩溃并且我得到 Bad Access错误代码 1。这是我尝试释放它的方式:
-(void)moveHair {
NSMutableArray *animateHair = [NSMutableArray arrayWithCapacity:10];
for (int i = 1; i < 10; i++) {
NSString *animHair = [NSString stringWithFormat:@"wRightLong%i.png", i];
CCSpriteFrame *whiteFrame = [frame spriteFrameByName:animHair];
[animateHair addObject:whiteFrame];
}
CCAnimation *blowHair = [CCAnimation animationWithSpriteFrames:animateHair delay:0.15];
CCAction *blowingHair = [CCRepeatForever actionWithAction:[CCAnimate actionWithAnimation:blowHair]];
[white runAction:blowingHair];
[animateHair release];
animateHair = nil;
}
为什么我会收到该错误,我该如何解决?