iOS-导入音频

1.工程文件->build phases ->link binary with libraries 导入 AVF
2.#import

  1. NSString *path = [[NSBundle mainBundle] pathForResource:@"enemy3_down.mp3" ofType:nil];

    _bombAudioPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:path] error:nil];
    _bombAudioPlayer.numberOfLoops = 1;
    [_bombAudioPlayer play];

你可能感兴趣的:(iOS-导入音频)