大家好!
我用Instruments检查内存时发现
[[SimpleAudioEngine sharedEngine] playEffect:INTO_SOUND_EFFECT_FILE];
[[SimpleAudioEngine sharedEngine] unloadEffect:INTO_SOUND_EFFECT_FILE];[[SimpleAudioEngine sharedEngine] playEffect:INTO_SOUND_EFFECT_FILE]; 内存泄露。
请问大家这该如何解决
[[SimpleAudioEngine sharedEngine] playBackgroundMusic:BACKGROUND_MUSIC_FILE loop:YES];
也如此
我用Instruments检查内存时发现
[[SimpleAudioEngine sharedEngine] playEffect:INTO_SOUND_EFFECT_FILE];
[[SimpleAudioEngine sharedEngine] unloadEffect:INTO_SOUND_EFFECT_FILE];[[SimpleAudioEngine sharedEngine] playEffect:INTO_SOUND_EFFECT_FILE]; 内存泄露。
请问大家这该如何解决
[[SimpleAudioEngine sharedEngine] playBackgroundMusic:BACKGROUND_MUSIC_FILE loop:YES];
也如此
[[SimpleAudioEngine sharedEngine]end];
没有[[SimpleAudioEngine sharedEngine] end]; 方法, 当我使用 [SimpleAudioEngine end]; 时异常- (void)ccTouchEnded:(UITouch*)touch withEvent:(UIEvent*)event
{
CGPoint location = [self convertTouchToNodeSpace:touch];
CCSprite* homeButton = (CCSprite*)[spriteBatchNode getChildByTag:HOME_BUTTON_TAG_VALUE];
// Reset button image (just in case the button is touched before)
[homeButton setDisplayFrame:
[[CCSpriteFrameCache sharedSpriteFrameCache] spriteFrameByName:@"home_button.png"]];
if (CGRectContainsPoint(homeButton.boundingBox, location) && homeButton == previousTouchBeganObject)
{
SimpleAudioEngine* simpleAudio = [SimpleAudioEngine sharedEngine];
[simpleAudio playEffect:OUT_SOUND_EFFECT_FILE];
// [simpleAudio stopBackgroundMusic];
[SimpleAudioEngine end];
AppController* delegate = (AppController*)[[UIApplication sharedApplication] delegate];
[delegate switchToParentModule];
return;
}
{
self = [super init];
if (self) {
self.touchEnabled = YES;
if(![[SimpleAudioEngine sharedEngine] isBackgroundMusicPlaying]){
[[SimpleAudioEngine sharedEngine] playBackgroundMusic:BACKGROUND_MUSIC_FILE loop:YES];
}
。