change Badge and push notification in iPhone SDK

送分小仙女□ 提交于 2020-01-13 11:28:26

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/3956585/change-badge-and-push-notification-in-iphone-sdk

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!