我使用此代码来循环播放我的Sprite Kit游戏中的一首歌曲,但是当我离开应用/游戏时,歌曲继续播放,并且我不知道如何停止歌曲下车游戏:声音一直在Sprite Kit游戏上播放
url = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"deep-blue-sea" ofType:@"wav"]];
_sound = [[AVAudioPlayer alloc] initWithContentsOfURL:url error:nil];
_sound.delegate = self;
_sound.numberOfLoops = -1;
[_sound play];
请有人可以帮我怎么做吗?
谢谢,但我必须在AppDelegate.h中实现AVAudioPlayer框架以使用stop方法吗?我在SKScene中声明了_sound属性,我如何在AppDelegate中使用它? – 2015-02-11 00:38:24
@FacundoSchiavoni看我的编辑。 – NobodyNada 2015-02-11 00:47:03