自动重复播放

我使用下面的代码播放声音

NSURL* musicFile = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"01" ofType:@"mp3"]]; AVAudioPlayer *audioPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:musicFile error:nil]; [audioPlayer play]; 

我想在完成时自动重复这个声音文件怎么样?

 audioPlayer.numberOfLoops = someNumber; 

或“无限”数目的循环:

 audioPlayer.numberOfLoops = -1; 
 player.numberOfLoops = -1; [player prepareToPlay]; [player play];