• iOS application: how to clear notifications?


    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];
  • 相关阅读:
    校园路的伤感
    IBM决赛的相片
    IBM一面blue面筋(D组)
    解读校园路
    learn english
    DoNews.COM确实不错
    ARC使用
    Mac 终端 加tab键索引功能
    制作越狱ios设备ipa包
    objc>JS通信及JS>objc通信
  • 原文地址:https://www.cnblogs.com/willbin/p/5504546.html
Copyright © 2020-2023  润新知