简体   繁体   English

在iPhone SDK中更改徽章并推送通知

[英]change Badge and push notification in iPhone SDK

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. 我想从推送通知中显示其他视图。

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. 您可以访问userInfo词典以获取有关导致消息回调的推送通知的其他信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM