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?的更多相关文章

  1. IOS Application Security Testing Cheat Sheet

    IOS Application Security Testing Cheat Sheet    [hide]  1 DRAFT CHEAT SHEET - WORK IN PROGRESS 2 Int ...

  2. [转]Running JavaScript in an iOS application with JavaScriptCore

    原文:https://www.infinum.co/the-capsized-eight/articles/running-javascript-in-an-ios-application-with- ...

  3. iOS Application Project与OS X Application Project对于plist使用的区别

    前几天因为在开源中国看到一个求源代码的问题: 模拟一个动物园系统MyZoo 1.动物园里面有三种动物:Panda,Elephant,Kangaroo 2.三种动物都有一定的数量(不止一只) 3.动物有 ...

  4. Persisting iOS Application Data in SQLite Database Using FMDB

    In previous articles we have utilized NSUserDefaults and .NET web services to persist iPhone data. N ...

  5. iOS Application Security

    文章分A,B,C,D 4个部分. A) iOS Application Security 下面介绍iOS应用安全,如何分析和动态修改app. 1)iOS Application security Pa ...

  6. Demystifying iOS Application Crash Logs

    http://www.raywenderlich.com/23704/demystifying-ios-application-crash-logs This is a blog post by So ...

  7. iOS Application Life Cycle 应用程序生命周期

    应用程序的状态 IOS的应用程序一共有5种状态. Not running(未运行):程序未启动 Inactive(未激活):其他两个状态切换时出现的短暂状态.唯一在此状态停留时间比较长的情况是:当用户 ...

  8. iOS application/json上传文件等

    在和sever后台交互的过程中.有时候.他们需要我们iOS开发者以“application/json”形式上传. NSString *accessUrl = [NSString stringWithF ...

  9. IOS Application生命周期

    第一阶段 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *) ...

随机推荐

  1. Ubuntu虚拟机与Window、Arm的通信

    Ubuntu虚拟机与Window的通信安装有Ubuntu14.04的虚拟机VMware,将虚拟机的网络适配器配置成NAT类型(默认使用VMnet8进行通信),此时将Ubuntu的IP地址设置成与VMn ...

  2. C# 返回json结果集,js日期格式化

    asp.net mvc返回json结果集 return Json(new { total = totalCount, rows = result }, JsonRequestBehavior.Allo ...

  3. 1028. List Sorting (25)

    #include <vector> #include <stdio.h> #include <string.h> #include <algorithm> ...

  4. 【CSLA】Component-based,Scalable,LogicalArchitecture

    我能说我没看懂吗 ? http://www.cnblogs.com/lonely7345/archive/2010/02/06/1665171.html

  5. mac使用wget下载网站(仿站)

    wget -c -r -np -k -L -p http://www.xxxx.com 参考 wget的安装 http://blog.csdn.net/ssihc0/article/details/7 ...

  6. easy ui datagrid在没有数据时显示相关提示内容

    $(function () { $('#dg').datagrid({ fitColumns: true, url: 'product.json', pagination: true, pageSiz ...

  7. easy ui 下拉框绑定数据select控件

    easy ui 中的下拉框控件叫做select,具体代码如下: html代码:①.这是一个公司等级的下拉框 <tr> <td>公司等级:</td> <td&g ...

  8. SVN备份教程(一)

    最近一段时间在项目中用到了SVN备份的相关内容,这里给大家做一个简单的教程,重点在于SVN备份环境的搭建过程中,大家学到的解决问题的思维方式. 1.分类 SVN备份主要分为两种:一种是远程备份,另一种 ...

  9. ubuntu的vi

    ubuntu12.04的vi 1. 安装vim full版本由于Ubuntu预安装的是tiny版本,就会导致我们在使用上的产生不便.所以我们要安装vim的full版本.首先,先卸掉旧版的vi,输入以下 ...

  10. Flume学习——Flume的架构

    Flume有三个组件:Source.Channel 和 Sink.在源码中对应同名的三个接口. When a Flume source receives an event, it stores it ...