更改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 ?
另一个问题是
当我单击视图时,它将出现在主屏幕上.我想从推送通知中显示其他视图.
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
您可以访问 userInfo 词典以获取有关导致消息回调的推送通知的其他信息.
You can access the userInfo dictionary to get additional information about the push notification that resulted in the message callback.
这篇关于更改iPhone SDK中的徽章并推送通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!