首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >快速本地通知声音不起作用怎么解决?

快速本地通知声音不起作用怎么解决?
EN

Stack Overflow用户
提问于 2018-06-14 06:25:31
回答 1查看 0关注 0票数 0

我在iOS上尝试使用声音进行本地通知。

代码语言:javascript
复制
let content = UNMutableNotificationContent()
content.title = "Intro to Notifications"
content.subtitle = "Lets code,Talk is cheap"
content.body = "Sample code from WWDC"
content.sound = UNNotificationSound(named: "out.caf")

// content.sound = UNNotificationSound(named: "out.caf")

let trigger = UNTimeIntervalNotificationTrigger.init(timeInterval: 5.0, repeats: false)
let request = UNNotificationRequest(identifier:self.peripheralUUID, content: content, trigger: trigger)

UNUserNotificationCenter.current().delegate = self
UNUserNotificationCenter.current().add(request){(error) in

    if (error != nil){

        print(error?.localizedDescription)
    }
}        

声音不起作用,只有震动才起作用。哪里不对?

EN

Stack Overflow用户

发布于 2018-06-14 16:04:59

首先,确保对目标memebership进行了文件检查,并尝试此扩展名。

代码语言:txt
复制
content.sound = UNNotificationSound(named: "out.aif")

还要确保持续时间<30秒。

票数 0
EN
查看全部 1 条回答
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/-100004918

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档