I used this code to loop a song in my Sprite Kit game but when I go out of the app/game the song keeps playing and I don't know how to stop the song when you get off the game:
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];
Please can someone help me how to do it?
Aucun commentaire:
Enregistrer un commentaire