AVAudioPlayer 应用小示例

NSString *soundPath=[[NSBundle mainBundle] pathForResource:NSLocalizedStringFromTable([_dictionary objectForKey:@"sound"],[defaults stringForKey:@"language"],@"提示") ofType:@"mp3"];
  NSURL *soundUrl=[NSURL fileURLWithPath:soundPath];
  _player=[[AVAudioPlayer alloc] initWithContentsOfURL:soundUrl error:nil];

 

NSString *soundPath=[[NSBundle mainBundle] pathForResource:@"sound" ofType:@"mp3"];
  NSURL *soundUrl=[NSURL fileURLWithPath:soundPath];
  _player=[[AVAudioPlayer alloc] initWithContentsOfURL:soundUrl error:nil];

你可能感兴趣的:(play)