这是我的游戏主菜单上的 init 方法:
-(id) init {
if( (self=[super initWithColor:ccc4(255, 255, 255, 255)])) {
// Get the screen dimensions
int screenWidth = [[CCDirector sharedDirector] winSize].width;
int screenHeight = [[CCDirector sharedDirector] winSize].height;
// Add the logo
CCSprite* logo = [[CCSprite node] initWithFile:@"Ninjasplash2.png"];
[logo setPosition:ccp(screenWidth/2.0,screenHeight * 0.65f)];
[self addChild:logo];
// Add the buttons
CCMenuItemLabel *startButton =
[CCMenuItemFont itemWithString:@"Start" target:self selector:@selector(onStart:)];
startButton.color = ccBLACK;
CCMenuItemLabel *quitButton =
[CCMenuItemFont itemWithString:@"Quit" target:self selector:@selector(onQuit:)];
quitButton.color = ccBLACK;
CCMenuItemLabel *optionsButton =
[CCMenuItemFont itemWithString:@"Options" target:self selector:@selector(onOptions:)];
optionsButton.color = ccBLACK;
CCMenu *menu = [CCMenu menuWithItems:startButton, quitButton, optionsButton, nil];
[menu alignItemsVertically];
[menu setPosition:ccp(screenWidth / 2, screenHeight*0.25f)];
[self addChild:menu];
// Get the music started, yeh mon
//[[SimpleAudioEngine sharedEngine] playBackgroundMusic:@"island.mp3" loop:true];
}
return self;
}
尝试添加徽标时,我收到上述错误,我完全不知道如何修复它。令人难以置信的令人沮丧。如果您需要我添加更多信息,请告诉我,我会很高兴。谢谢你。另外,我读过它可能与内存管理和释放有关,但它甚至不会加载这个主屏幕,所以没有什么可以释放的。
我相信堆栈跟踪:
#0 0x01956df5 in objc_release ()
#1 0x01957c60 in (anonymous namespace)::AutoreleasePoolPage::pop(void*) ()
#2 0x01c8aed8 in _CFAutoreleasePoolPop ()
#3 0x002c4385 in CA::Display::DisplayLink::dispatch(unsigned long long, unsigned long long) ()
#4 0x002c41af in CA::Display::TimerDisplayLink::callback(__CFRunLoopTimer*, void*) ()
#5 0x01d2a966 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ ()
#6 0x01d2a407 in __CFRunLoopDoTimer ()
#7 0x01c8d7c0 in __CFRunLoopRun ()
#8 0x01c8cdb4 in CFRunLoopRunSpecific ()
#9 0x01c8cccb in CFRunLoopRunInMode ()
#10 0x02a20879 in GSEventRunModal ()
#11 0x02a2093e in GSEventRun ()
#12 0x00845a9b in UIApplicationMain ()
#13 0x000c6526 in main at /Users/MaristUser/Desktop/Ninja Run/Ninja Run/main.m:14