Ios UILocalNotification声音不工作
我对UILocalNotification的声音有一些问题。我拥有应用程序委派中的用户权限 这是我的密码:Ios UILocalNotification声音不工作,ios,swift,uilocalnotification,Ios,Swift,Uilocalnotification,我对UILocalNotification的声音有一些问题。我拥有应用程序委派中的用户权限 这是我的密码: var nottypes:UIUserNotificationType = UIUserNotificationType.Alert | UIUserNotificationType.Badge | UIUserNotificationType.Sound var notsettings:UIUserNotificationSettings = UIUserNotificationSett
var nottypes:UIUserNotificationType = UIUserNotificationType.Alert | UIUserNotificationType.Badge | UIUserNotificationType.Sound
var notsettings:UIUserNotificationSettings = UIUserNotificationSettings(forTypes: nottypes, categories: nil)
application.registerUserNotificationSettings(notsettings)
通知代码:
var notification:UILocalNotification = UILocalNotification()
notification.alertBody = "Simple"
notification.alertTitle = "Back To App!"
notification.fireDate = NSDate(timeIntervalSinceNow: 20)
notification.soundName = "Chord"
UIApplication.sharedApplication().scheduleLocalNotification(notification)
在S.O.上发布问题之前,您应始终查看文件。如果您阅读了物业定义的第一行,其中写道: 对于此属性,请指定应用程序主捆绑包或UILocalNotificationDefaultSoundName中声音资源的文件名(包括扩展名),以请求默认系统声音。当系统显示本地通知警报或标记应用程序图标时,会播放此声音。默认值为零(无声音)。不支持持续时间超过30秒的声音。如果指定的文件的声音播放时间超过30秒,将改为播放默认声音 因此,请尝试:
notification.soundName = "Chord.mp3" // use .mp3 or your file extension if it is not an mp3
在S.O.上发布问题之前,您应始终查看文件。如果您阅读了物业定义的第一行,其中写道: 对于此属性,请指定应用程序主捆绑包或UILocalNotificationDefaultSoundName中声音资源的文件名(包括扩展名),以请求默认系统声音。当系统显示本地通知警报或标记应用程序图标时,会播放此声音。默认值为零(无声音)。不支持持续时间超过30秒的声音。如果指定的文件的声音播放时间超过30秒,将改为播放默认声音 因此,请尝试:
notification.soundName = "Chord.mp3" // use .mp3 or your file extension if it is not an mp3
在S.O.上发布问题之前,您应始终查看文件。如果您阅读了物业定义的第一行,其中写道: 对于此属性,请指定应用程序主捆绑包或UILocalNotificationDefaultSoundName中声音资源的文件名(包括扩展名),以请求默认系统声音。当系统显示本地通知警报或标记应用程序图标时,会播放此声音。默认值为零(无声音)。不支持持续时间超过30秒的声音。如果指定的文件的声音播放时间超过30秒,将改为播放默认声音 因此,请尝试:
notification.soundName = "Chord.mp3" // use .mp3 or your file extension if it is not an mp3
在S.O.上发布问题之前,您应始终查看文件。如果您阅读了物业定义的第一行,其中写道: 对于此属性,请指定应用程序主捆绑包或UILocalNotificationDefaultSoundName中声音资源的文件名(包括扩展名),以请求默认系统声音。当系统显示本地通知警报或标记应用程序图标时,会播放此声音。默认值为零(无声音)。不支持持续时间超过30秒的声音。如果指定的文件的声音播放时间超过30秒,将改为播放默认声音 因此,请尝试:
notification.soundName = "Chord.mp3" // use .mp3 or your file extension if it is not an mp3
我遇到了同样的问题,我必须执行以下步骤:
afconvert-f-caff-dLEI16@44100-c 1 in.wav out.caf
localNotification.soundName=“Chord.caf”代码>
检查在show file inspector中选择了声音文件“Target Membership”(目标成员身份)。我遇到了相同的问题,我必须执行以下步骤:
afconvert-f-caff-dLEI16@44100-c 1 in.wav out.caf
localNotification.soundName=“Chord.caf”代码>
检查在show file inspector中选择了声音文件“Target Membership”(目标成员身份)。我遇到了相同的问题,我必须执行以下步骤:
afconvert-f-caff-dLEI16@44100-c 1 in.wav out.caf