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

查看:235
本文介绍了为应用程序设置默认的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.

我正在使用本地通知来提醒现在发生的事件。一个横幅在它出现后不久就消失了(并且它不够明显,人们可以点击它),所以对于这些通知,需要将警报样式通知保留在屏幕上直到用户决定一个动作(忽略或去到app)。

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,不知何故我问过这个并且已经回答了。来自QuinnThe Eskimo!:

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本地通知样式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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