iOS 播放本地音频

#import 


-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
    
    CFURLRef urlRef = (__bridge CFURLRef)([[NSBundle mainBundle] URLForResource:@"in.caf" withExtension:nil]);
    
    SystemSoundID  soudID;
    
    //    AudioServicesCreateSystemSoundID(urlRef, soudID);
    
    AudioServicesCreateSystemSoundID(urlRef, &soudID);
    
    AudioServicesPlaySystemSound(soudID);
    
    
}

你可能感兴趣的:(iOS 播放本地音频)