如何播放日历警报声音和弦(默认)?

时间:2018-03-12 17:18:38

标签: ios objective-c audio

我发现只有经典的声音ID,但我需要Chord(默认)Calendar Alert。我怎么能播放那个声音? TKS

#define systemSoundID 1315  
AudioServicesPlaySystemSound (systemSoundID);

1 个答案:

答案 0 :(得分:0)

日历提醒应为:

#define systemSoundID 1005
  

Apple Audio Services : Predefined Sounds
   注意:这些是未记录的枚举值,其中   意味着您不应该依赖AppStore应用程序。

替代方法:

NSURL *fileURL = [NSURL URLWithString:
                 @"/System/Library/Audio/UISounds/nano/Alert_Calendar_Haptic.caf"];

SystemSoundID soundID;
    AudioServicesCreateSystemSoundID((__bridge_retained CFURLRef)fileURL, &soundID);
    AudioServicesPlaySystemSoundWithCompletion(soundID, NULL);
    AudioServicesPlaySystemSoundWithCompletion(kSystemSoundID_Vibrate, NULL);

您还可以在应用包中添加音频文件,或从系统库中调用它。

Currently Available System Sounds (iOS 11)