我可以发送没有声音的本地通知吗? [英] Can I send a Local Notification with no sound?

查看:82
本文介绍了我可以发送没有声音的本地通知吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要一些本地通知,没有显示,没有声音,但只有振动。只需将 alertBody 设置为 @,我就可以不进行显示,但我怎么能发送不声音?我想如果我没有从你们那里得到更好的方法,我将能够发出一个空的声音,将它添加到我的项目中,然后将soundName设置为该声音。但有没有任何默认的方法来做到这一点?

I want to have a few local notifications with no display and no sound, but only a vibration. I can get it to do no display, by simply setting alertBody to @"", but how can I send no sound? I am thinking if I don't get a better way from you guys, that I will be able to just make a sound that is empty, add it to my project, then set soundName to that sound. But is there any sort of default way to do this?

如果我添加一个虚假的声音名称,它仍然会播放默认的通知声音。

If I add a phony sound name it still plays the default notification sound.

谢谢!

推荐答案

不,你不能禁用声音,因为UILocalNotification没有为此提供任何选项。所以更好的选择是你在问题中告诉我使用一个空的声音文件。

No you can not disable sound because UILocalNotification does not provide any option for this. So better option is as you told in your question to use a empty sound file.

这篇关于我可以发送没有声音的本地通知吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆