Guest User

Untitled

a guest
Jan 17th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. SystemSoundID soundID = 0;
  2. CFURLRef soundFileURL = (CFURLRef)[NSURL URLWithString:somePathString];
  3. OSStatus errorCode = AudioServicesCreateSystemSoundID(soundFileURL, &soundID);
  4. if (errorCode != 0) {
  5. // Handle failure here
  6. }
  7.  
  8. AudioServicesPlaySystemSound(soundID);
  9.  
  10. SystemSoundID SoundID;
  11. NSString *soundPath = [[NSBundle mainBundle] pathForResource:@"beep" ofType:@"caf"];
  12. NSURL *soundURL = [NSURL fileURLWithPath:soundPath];
  13. AudioServicesCreateSystemSoundID((__bridge CFURLRef)soundURL, &SoundID);
  14. AudioServicesPlaySystemSound(SoundID);
Add Comment
Please, Sign In to add comment