本文介绍了如何检查我们的应用程序的通知警报样式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要的是将通知提醒样式更改为提醒
但是我们知道我们无法以编程方式执行此操作。

What exactly I wanted is to change the Notification Alert Style to "Alerts"But came to know that we can't do it programatically.

现在让我们来到场景,

我有一个 UILocalNotification 设置 repeatinterval = kCFCalendarUnitMinute 。因此,如果我不取消通知,它会在通知窗口中显示新通知。

I have a UILocalNotification set with the repeatinterval = kCFCalendarUnitMinute. So each minute it shows new notification in the notification Window if I don't cancel it.

现在说,我让设备闲置了10分钟,然后我会被10个通知轰炸,虽然我已经设置了一个带有重复间隔的通知。

Now Say, I have kept the device idle for 10 minutes then I will be bombarded with 10 notifications though I have set a single notification with repeatinterval.

主要问题:是否有任何方式只显示最后一个通知。

就像我有以相同的方式给出1分钟的示例以每7天重复一次为例。取消通知也将取消即将到来的下周通知。

Like I have given the Example of 1 minute in the same way Take an example of Repeating each 7 days. Cancelling the Notification will cancel the upcoming notification of the next week too.

所有这10个通知中唯一的共同点是 fireDate 每次使用 nextFireDate 值不同。

The only thing Common in all these 10 notifications is the fireDate with nextFireDate value as different each time.

因此我想切换警报样式到警报但由于我们无法通过代码更改它。

Because of this I wanted to switch the alert Style to "Alerts" but since we cannot change it through code.

我需要在每次启动时提醒用户将通知警报样式更改为警报 默认情况下,Banner会更改它。

I need to alert user at each startup to change his Notification alert Style" to "Alerts" Which by default is Banner until he change it.

所以现在我有2个问题依赖:

So now I have 2 questions with dependencies:


  1. 有没有办法检查当前通知提示样式无,横幅,提醒对于当前应用程序通过编码?

  2. 如果1为YES,那么,有没有办法将用户直接带到我们的设置通知警报样式屏幕app。

  1. Is there any way to CHECK the current Notification Alert Style i.e None, Banner, Alerts for the current app through Coding?
  2. If for 1 its YES, then, Is there any way to take the user directly to the Set notification Alert Style Screen right away from our app.

注意:
对于第2点。

Note:For Point 2.

我想到的一件事是向用户显示到达那里的路径设置 - >通知 - > MyAlarmApp - >提醒方式 - >提醒

One thing in my mind is to show user the path to reach there "Settings-> Notifications -> MyAlarmApp -> Alert Style -> Alerts".

欢迎任何其他建议。

推荐答案

您无法以编程方式更改或检测通知的样式,只有用户在设置应用中更改此内容。

You can't change or detect the style of notification programmatically, only the user change this in the settings app.

您也无法再打开设置应用程序,因此将由显示通知的用户决定。这完全不受您的控制。

You also can't open the settings app anymore, thus it will be up to the user who the notification will be displayed. It's totally out of your control.

如您所述,您可以要求用户更改应用程序的通知显示方式。

Like you stated you could ask the user to change the way notification are displayed for your app.

这篇关于如何检查我们的应用程序的通知警报样式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-19 20:26