更改 iPhone SDK 中的徽章和推送通知

发布于 2024-09-27 13:08:50 字数 246 浏览 2 评论 0原文

我尝试了 推送通知教程 。它工作正常,但问题是徽章。当我单击视图时,会出现应用程序并将其关闭。它在应用程序图标中仍然是红色徽章。如何去除它?

另一个问题是

当我单击视图时,它将出现主屏幕。我想在来自推送通知时显示其他视图。

I tried the push notification tutorial . It's working fine but problem is badge. When I click on the view, app is appear and the close it. it still red badge in app icon. How to remove it ?

Another question is

when I click the view, it will appear home screen. I want to show other view when coming from push notification.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

万水千山粽是情ミ 2024-10-04 13:08:50

这将重置应用程序徽章编号。如果将该值设置为零,它将隐藏徽章。

[UIApplication sharedApplication].applicationIconBadgeNumber = iCount;

要使用单独的视图处理推送通知,您需要在应用程序委托中处理以下消息:

- (void)application:(UIApplication *)app didReceiveRemoteNotification:(NSDictionary *)userInfo

您可以访问userInfo字典以获取有关导致消息回调的推送通知的更多信息。

This will reset the application badge number. If you set that value to zero, it will hide the badge.

[UIApplication sharedApplication].applicationIconBadgeNumber = iCount;

To handle your push notification with a separate view, you need to handle the following message in your application delegate:

- (void)application:(UIApplication *)app didReceiveRemoteNotification:(NSDictionary *)userInfo

You can access the userInfo dictionary to get additional information about the push notification that resulted in the message callback.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文