为应用程序设置默认的 iOS 本地通知样式

Set default iOS local notification style for application(为应用程序设置默认的 iOS 本地通知样式)

本文介绍了为应用程序设置默认的 iOS 本地通知样式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从 iOS 5 开始,有两种通知样式:横幅和警报(旧"样式).用户可以在设置中为每个应用程序设置使用哪种样式.但是,现在的默认设置似乎是通知以横幅样式显示.

Starting with iOS 5, there are two notification styles: banner and alert (the "old" style). A user can set which style to use for each application in the settings. However, the default now seems to be that notifications are displayed banner style.

我正在使用本地通知来提醒现在"将要发生的事件.横幅在它出现后不久就会消失(并且它不够明显以至于人们可以点击它),因此对于这些通知,最好有警报样式通知,因为这些通知会一直留在屏幕上,直到用户决定采取行动(忽略或去到应用程序).

I'm using local notifications for reminders about events that will happen "now". A banner disappears shortly after it appeared (and it's not obvious enough that one can tap it), so for these notifications it would be desirable to have the alert style notifications as those stay on screen until the user decided on an action (ignore or go to app).

有没有办法通过代码或例如 Info.plist 条目告诉 iOS 默认情况下应该使用警报样式通知(只要用户没有配置其他东西)?

Is there a way either through code or for example Info.plist entries to tell iOS that the alert style notifications should be used by default (as long as the user hasn't configured something else)?

更新:信息/文档的缺失不足以让我解决这个问题.我想要一个有权威的人(Apple 员工或类似 Erica Sadun 的人)发表的论坛/博客帖子之类的东西,说这是不可能的,或者如果有可能,那么我想要解决方案.要求用户更改设置" 之类的解决方法也不够好.

Update: The absence of information/documentation is not enough for me to have this settled. I want either something like a forum/blog post from someone with authority (Apple employee or someone along the lines of Erica Sadun) saying it's not possible, or if it is possible then I want the solution. A workaround like "ask the user to change the setting" isn't good enough either.

推荐答案

我想补充一点,因为我已经打开了一个 TSI,不知何故我问了这个问题并得到了答复.来自奎因爱斯基摩人!":

I would like to add something, since I've opened a TSI and somehow I asked about this and have been answered. From Quinn "The Eskimo!":

这取决于您的意思.您可以根据您设置 UILocalNotification 属性(如 alertBody、soundName 等)的方式来控制通知的显示方式.但是,如果您询问进入的方式这些属性被解释(用户可以在设置>通知中自定义的东西),这些是用户偏好,不通过任何 API 公开."

"This depends on you mean. You have some control over how the notification appears based on how you set the UILocalNotification properties (things like alertBody, soundName, and so on). However, if you're asking about the way in which those properties are interpreted (the things the user can customise in Settings > Notifications), those are user preferences and not exposed via any API."

这篇关于为应用程序设置默认的 iOS 本地通知样式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:为应用程序设置默认的 iOS 本地通知样式

基础教程推荐