jjzjj

UNNotificationSound

全部标签

ios - UNNotificationSound.default() 是什么声音?

我的iOS应用使用默认的通知声音:letcontent=UNMutableNotificationContent()content.sound=UNNotificationSound.default()我听到了名为“Tri-Tone”的声音,尽管我的设置面板“声音”View中的任何地方都没有设置该声音。我希望听到为“提醒警报”设置的声音。谁能解决这个问题? 最佳答案 根据officialdocumentation它播放通知的默认声音。我认为系统不会让您更改默认声音。如果您是应用程序的开发者,则必须随应用程序提供您自己的声音文件。

ios - 为什么只播放 UNNotificationSound 的前 5 秒

更新到iOS10.1.1后,iOS通知自定义声音会在5秒后停止。只有在设备打开时才会发生这种情况,但如果设备关闭,它会播放整整30秒。UNNotificationSound文档说:Youcanpackagetheaudiodatainanaiff,wav,orcaffile.Soundfilesmustbelessthan30secondsinlength.Ifthesoundfileislongerthan30seconds,thesystemplaysthedefaultsoundinstead.https://developer.apple.com/reference/usern

ios - 来自 UNNotificationSound 的声音名称

我正在使用CloudKit中的推送通知。这是我在Swift3之前使用的:notification.soundName=UILocalNotificationDefaultSoundName(通知是一个CKNotificationInfo)但是,这给了我一个警告:'UILocalNotificationDefaultSoundName'wasdeprecatediniOS10.0:UseUserNotificationsFramework's+[UNNotificationSounddefaultSound]所以我将UserNotification框架添加到我的Xcode项目中,并将其导