- (void)viewDidLoad {
[super viewDidLoad];
[audioPlayer stop];
NSString *Path = [[NSBundle mainBundle] pathForResource:@"Keep the Shoes Moving" ofType: @"m4a"];
NSURL *URL = [[NSURL alloc] initFileURLWithPath: Path];
NSError *error;
audioPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:URL error:&error];
audioPlayer.numberOfLoops = -1;
[audioPlayer play];
[[UIDevice currentDevice] endGeneratingDeviceOrientationNotifications]; }
これで何が起こるかというと、この viewController に戻るたびに、別のトラックが再生されます。それで、2 つのトラックを重ねて再生しています。どうすればこれを止めることができますか??