私はcocos2dを使用してコードを書いています。割り当てたメモリをすべて解放したい。私は次のようにdeallocメソッドでそれを行いました。
私がリリースしたすべてのオブジェクトはインターフェイスファイルで宣言され、プロパティ(割り当て)が設定され、実装ファイルで合成されます。
allocメソッドを使用して次のように作成しました
self.PlayerA = [[CCSprite alloc] initWithFile:@" PlayerImage_01.png"];
-(void)dealloc
{
int count , i ;
count = [self.PlayerA retainCount];
for(i = 0; i < count; i++)
[self.PlayerA release];
count = [self.targetLayer retainCount];
for(i = 0; i < count; i++)
[self.targetLayer release];
count = [self.playerGunSlowDrawSheet retainCount];
for(i = 0; i < count; i++)
[self.playerGunSlowDrawSheet release];
count = [self.playerGunSlowDrawAnimation retainCount];
for(i = 0; i < count; i++)
[self.playerGunSlowDrawAnimation release];
count = [self.numberFinishedTime retainCount];
for(i = 0; i < count; i++)
[self.numberFinishedTime release];
count = [self.backGroundImage retainCount];
for(i = 0; i < count; i++)
[self.backGroundImage release];
[[CCTextureCache sharedTextureCache] removeAllTextures];
[[CCSpriteFrameCache sharedSpriteFrameCache] removeSpriteFrames];
[super dealloc];
}
しかし、私は次のようになっています。プログラム受信信号:「EXC_BAD_ACCESS」。デバッガーでは、[superdealloc]でエラーが表示されています。
私はメモリ管理で完全に間違っていますか?または私はこれで何かが欠けていますか?ありがとうございました。