0

Cocos2d ゲームを作成していますが、アプリを実行すると「Thread 1:EXC_BAD_ACCESS(code=1, address=0xe000000c) error」というエラーが表示されます。問題の原因と思われるコードは次のとおりですが、問題を特定できません。

これがコードです。

#import "BlueEnemy.h"


@implementation BlueEnemy
+(id)createBlueEnemy{
    return [[[self alloc]init]autorelease];
}

-(id)init{
    if ((self = [super init])) {
        CGSize size = [[CCDirector sharedDirector]winSize];
        screenWidth = size.width;
        screenHeight = size.height;

        screenBounds = [[UIScreen mainScreen] bounds];

        blueEnemyFlameCounter = 1;

        xPointBlueEnemy = screenWidth - 50;
        yPointBlueEnemy = screenHeight - 100;

        [self schedule:@selector(blueEnemyFlight:)interval:28.0f/1.0f];
    }
    return self;
}

-(void)blueEnemyFlight:(ccTime)delta{
    blueEnemy = [CCSprite spriteWithFile:@"blueenemy.png"];
    blueEnemy.position = ccp(xPointBlueEnemy, yPointBlueEnemy);
    [self addChild:blueEnemy z:-1];

    CCMoveTo* blueEnemyMoveDown  = [CCMoveTo actionWithDuration:3.0        position:ccp(xPointBlueEnemy, 70)];
    CCMoveTo* blueEnemyMoveUp = [CCMoveTo actionWithDuration:3.0 position:ccp(xPointBlueEnemy, yPointBlueEnemy - 60)];
    CCSequence* blueEnemyFloatingSequence = [CCSequence actions:blueEnemyMoveDown, blueEnemyMoveUp, nil];
    CCRepeat* blueEnemyFloatingRepeat = [CCRepeat actionWithAction:blueEnemyFloatingSequence times:3];
    [blueEnemy runAction:blueEnemyFloatingRepeat];

    [self schedule:@selector(shootTheWaterBullets:)interval:1.0f/2.0f];

    [self schedule: @selector(blueEnemyFlame:)interval:1.0f/5.0f];

    [self schedule: @selector(removeTheBlueEnemy:)interval:20.0f/1.0f];
}

-(void)blueEnemyFlame:(ccTime)delta{
    blueEnemyFlameCounter ++;

    if (blueEnemyFlameCounter % 2){
        [blueEnemy setTexture:[[CCSprite spriteWithFile:@"blueenemy2.png"]texture]];
    }else{
        [blueEnemy setTexture:[[CCSprite spriteWithFile:@"blueenemy.png"]texture]];
    }
}

-(void)removeTheBlueEnemy:(ccTime)delta{
    CCMoveBy* moveUpBlueEnemy = [CCMoveBy actionWithDuration:0.5 position:ccp(70, 100)];
    [blueEnemy runAction:moveUpBlueEnemy];
    [blueEnemy removeChild:blueEnemy cleanup:YES];
    [self unschedule:@selector(removeTheBlueEnemy:)];
}
@end

私はcocos2dとobjective cに非常に慣れていないので、これがあなたが探しているものかどうかはわかりませんが、とにかく:

libobjc.A.dylib`objc_msgSend_stret:
0x2267328: movl 12(%esp), %ecx
0x226732c: movl 8(%esp), %eax
0x2267330: testl %eax, %eax
0x2267332: ジェ 0x2267398 ; objc_msgSend_stret + 112
0x2267334: 移動 (%eax)、%edx
0x2267336: movzwl 12(%edx), %eax
0x226733a: andl %ecx, %eax
0x226733c: シェル $3、%eax
0x226733f: addl 8(%edx), %eax
0x2267342: cmpl (%eax)、%ecx
0x2267344: jne 0x226734b ; objc_msgSend_stret + 35
0x2267346: testl %eax, %eax
0x2267348: jmpl *4(%eax)
0x226734b: cmpl $0、(%eax)
0x226734e: ジェ 0x2267399 ; objc_msgSend_stret + 113
0x2267350: cmpl 8(%edx)、%eax
0x2267353: ジェ 0x2267361 ; objc_msgSend_stret + 57
0x2267355: subl $8、%eax
0x2267358: cmpl (%eax)、%ecx
0x226735a: jne 0x226734b ; objc_msgSend_stret + 35
0x226735c: testl %eax, %eax
0x226735e: jmpl *4(%eax)
0x2267361: movzwl 12(%edx), %eax
0x2267365: シェル $3、%eax
0x2267368: addl 8(%edx)、%eax
0x226736b: jmp 0x226737a ; objc_msgSend_stret + 82
0x226736d: cmpl $0、(%eax)
0x2267370: ジェ 0x2267399 ; objc_msgSend_stret + 113
0x2267372: cmpl 8(%edx)、%eax
0x2267375: ジェ 0x2267383 ; objc_msgSend_stret + 91
0x2267377: subl $8、%eax
0x226737a: cmpl (%eax)、%ecx
0x226737c: jne 0x226736d ; objc_msgSend_stret + 69
0x226737e: testl %eax, %eax
0x2267380: jmpl *4(%eax)
0x2267383: pushl %ebp
0x2267384: movl %esp, %ebp
0x2267386: プッシュ $0
0x2267388: プッシュ $0
0x226738a: プッシュ $0
0x226738c: pushl %edx
0x226738d: pushl %ecx
0x226738e: 移動 12(%ebp)、%ecx
0x2267391: pushl %ecx
0x2267392: calll 0x2255720 ; objc_msgSend_corrupt_cache_error
0x2267397: いいえ    
0x2267398: 戻る    
0x2267399: movl 12(%esp), %ecx
0x226739d: 移動 8(%esp)、%eax
0x22673a1: pushl %ebp
0x22673a2: movl %esp, %ebp
0x22673a4: subl $12、%esp
0x22673a7: pushl %edx
0x22673a8: pushl %ecx
0x22673a9: pushl %eax
0x22673aa: calll 0x225f017 ; _class_lookupMethodAndLoadCache3
0x22673af: 離れる  
0x22673b0: testl %eax, %eax
0x22673b2: jmpl *%eax

これが@bbumに役立つことを願っています

4

0 に答える 0