UILocalNotification自定义soundName仅在指定alertBody时振动手机(与UILocalNotificationDefaultSoundName不同)? [英] UILocalNotification custom soundName only vibrates phone when alertBody is specified (unlike UILocalNotificationDefaultSoundName)?

查看:140
本文介绍了UILocalNotification自定义soundName仅在指定alertBody时振动手机(与UILocalNotificationDefaultSoundName不同)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个VoIP应用程序,它使用UILocalNotification在应用程序在后台时通知用户来电。当出现通知时,我希望它能发出声音和声音。振动电话 - 不止一次(并且没有反复出现相同的消息)。我能够通过使用一系列通知来做到这一点 - 第一个会立即显示消息并播放声音(手机也会振动) - 以下通知被安排3秒间隔;它们没有alertBody和alertAction,但具有与第一个通知中使用的相同的声音名称。这是我的问题..如果指定了除UILocalNotificationDefaultSoundName之外的声音名称,则手机将仅在第一次通知时振动(虽然每次都会播放声音)。但是,如果使用默认的soundName,那么手机会在每次通知时振动吗?还有另一种方法吗?

I have a VoIP app that uses a UILocalNotification to notify the user of an incoming call when the app is in the background. When a notification is presented I would like it to play a sound & vibrate the phone -- more than once (and without presenting the same message repeatedly). I was able to do this by using a series of notifications - the first would immediately present the message and play a sound (the phone would vibrate as well) - following notifications were scheduled 3 seconds apart; they do not have an alertBody and alertAction but do have the same soundname as used in the first notification. HERE IS MY PROBLEM.. if a soundName other than the UILocalNotificationDefaultSoundName is specified the phone will only vibrate for the first notification (the sound will be played each time though). However, if the default soundName is used, then the phone will vibrate with each notification? Is there another way to do this?

推荐答案

找到另一种方式..显示本地通知然后通过计时器开始重复振动。

Found another way.. display local notification and then start repeating the vibration via a timer.

这篇关于UILocalNotification自定义soundName仅在指定alertBody时振动手机(与UILocalNotificationDefaultSoundName不同)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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