iOS 5:我可以让我的应用程序“在通知中心"吗?默认情况下?

人气:641 发布:2022-10-16 标签: default notifications preferences ios5 uilocalnotification

问题描述

我在 App Store 中有一个 iPad 应用,其逻辑主要依赖于本地通知.换句话说,应用程序内部发生的很多事情都是由委托方法应用程序 didReceiveLocalNotification 触发的.

I have an iPad app in the App Store whose logic relies largely on local notifications. In other words, much that happens inside the app is triggered by the delegate method application didReceiveLocalNotification.

随着今天发布的 iOS 5,我看到应用程序可以(通过设置)放置在通知中心"或不在通知中心".到目前为止,我还没有在新文档中找到任何内容,但我希望有一种方法可以让我的应用程序默认在通知中心",(甚至可能将声音设置为活动状态并将通知类型设置为警报)让我不必向新用户明确解释在他们下载 & 之后安装我的应用程序,他们将不得不手动去选择应用程序在通知中心".

With today's release of iOS 5, I see that apps can be placed (via Settings) either "In Notification Center" or "Not In Notification Center." I haven't found anything in the new documentation so far, but I'm hoping there is a way to have my app "In Notification Center" by default, (and possibly even set Sounds active and the notification type to Alert) which would save me having to explicitly explain to new users that after they download & install my app, they will have to manually go and elect for the app to be "In Notification Center."

有谁知道这可能吗?似乎由于应用程序可以注册本地通知,因此默认情况下它应该能够接收它(无论是否在新的通知中心显示警报或项目).提前致谢.

Anyone know if this is possible? Seems that since an app can register a local notification, it should be able to receive it, by default (whether it displays an alert or an item in the new Notification Center, or not). Thanks in advance.

推荐答案

我遇到了同样的问题.我在文档中看到的唯一线索是新的通知中心处理本地和远程通知.因此,我认为该应用程序应该像远程通知一样注册本地.添加了这段代码-

I've encountered the same problem. The only clue I saw in documentation is that the new Notification Center handles both local and remote notifications. Therefor I assumed that the app should register for local as it would for remote notification. Added this piece of code -

[[UIApplication sharedApplication] registerForRemoteNotificationTypes: (UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound)];

在我的应用安排本地通知后,它出现在通知中心"中.

and after my app scheduled a local notification it appeared at the "In Notification Center".

但是,如果我的应用程序已经出现在不在通知中心"中,似乎没有任何影响.那么,我的所有在下一次更新之前运行该应用程序的客户都被搞砸了吗?

BUT it seems to have no affect if my app already appears in "Not In Notification Center".. So have all of my customers that ran the app before the next update got screwed?

552