首页 > 移动平台 > 详细

iOS application: how to clear notifications?

时间:2016-05-18 12:33:22      阅读:233      评论:0      收藏:0      [点我收藏+]

http://stackoverflow.com/questions/8682051/ios-application-how-to-clear-notifications

 

Just to expand on pcperini‘s answer. As he mentions you will need to add the following code to yourapplication:didFinishLaunchingWithOptions: method;

[[UIApplication sharedApplication] setApplicationIconBadgeNumber: 0];
[[UIApplication sharedApplication] cancelAllLocalNotifications];

You Also need to increment then decrement the badge in your application:didReceiveRemoteNotification: method if you are trying to clear the message from the message centre so that when a user enters you app from pressing a notification the message centre will also clear, ie;

[[UIApplication sharedApplication] setApplicationIconBadgeNumber: 1];
[[UIApplication sharedApplication] setApplicationIconBadgeNumber: 0];
[[UIApplication sharedApplication] cancelAllLocalNotifications];

iOS application: how to clear notifications?

原文:http://www.cnblogs.com/willbin/p/5504546.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!