本地推送UILocalNotification
//本地推送---无需网络,由本地发起
UILocalNotification *localNotification = [[UILocalNotification alloc]init];
//设置推送时间间隔并开启推送fireDate
localNotification.fireDate = [NSDate dateWithTimeIntervalSinceNow:10];
//设置提醒内容
localNotification.alertBody = @"注意要吃饭了";
//设置提醒标题
localNotification.alertTitle = @"提示";
//未读数图标显示badgeNumber
localNotification.applicationIconBadgeNumber = 2;
//定时推送
[[UIApplication shareApplication] scheduleLocalNotification:localNotification];
iOS8 以后需要添加如下步骤
//获取当前设备的系统版本UIDevice
if ([UIDevice currentDevice].systemVersion.floatValue > 8.0) {
UIUserNotificationSettings *setting = [UIUserNotificationSettings settingsForTypes:UIUserNotificationTypeBadge|UIUserNotificationTypeSound|UIUserNotificationTypeAlert categories:nil];
//注册推送 以及 推送相关设置
[[UIApplication sharedApplication]registerUserNotificationSettings:setting];
}
//上文中设置
applicationIconBadgeNumber
在阅读完推送信息后应当清零
此时应该在AppDelegate文件中
设置
//已经收到推送信息后调用的方法
- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification{
application.applicationIconBadgeNumber = 0;
}
本地推送UILocalNotification的更多相关文章
- 本地推送UILocalNotification(转)
1.增加一个本地推送 //设置20秒之后 NSDate *date = [NSDate dateWithTimeIntervalSinceNow:]; //chuagjian一个本地推送 UILoca ...
- Swift - 推送之本地推送(UILocalNotification)添加Button的点击事件
上一篇讲到的本地推送是普通的消息推送,本篇要讲一下带按钮动作的推送消息 import UIKit @UIApplicationMain class AppDelegate: UIResponder, ...
- Swift - 推送之本地推送(UILocalNotification)
// 本地推送通知是通过实例化UILocalNotification实现的.要实现本地化推送可以在AppDelegate.swift中添加代码实现,本事例是一个当App进入后台时推送一条消息给用户. ...
- 本地推送UILocalNotification的一些简单方法
1.添加本地推送,需要在app添加推送.可以根据通知的userInfo的不同的键值对来区分不同的通知 UILocalNotification *notification = [[UILocalNoti ...
- SWIFT推送之本地推送(UILocalNotification)之二带按钮的消息
上一篇讲到的本地推送是普通的消息推送,本篇要讲一下带按钮动作的推送消息,先上个图瞅瞅: 继上一篇的内容进行小小的改动: 在didFinishLaunchingWithOptions方法内进行以下修改 ...
- SWIFT推送之本地推送(UILocalNotification)
本地推送通知是通过实例化UILocalNotification实现的.要实现本地化推送可以在AppDelegate.swift中添加代码实现,本事例是一个当App进入后台时推送一条消息给用户. 1.首 ...
- [转载]iOS本地推送-备用
第一步:创建本地推送// 创建一个本地推送UILocalNotification *notification = [[[UILocalNotification alloc] init] autorel ...
- cocos2d-x中本地推送消息
作者:HU 转载请注明,原文链接:http://www.cnblogs.com/xioapingguo/p/4038277.html IOS下很简单: 添加一条推送 void PushNotific ...
- [iOS 高级] iOS远程推送与本地推送大致流程
本地推送: UILocalNotification *notification=[[UILocalNotification alloc] init]; if (notification!=nil) { ...
随机推荐
- 字节b换算kb/mb/gb/tb/pb
public static string HumanReadableFilesize(double size) { string[] units = new string[] { "B&qu ...
- 互联网商业模式O2O、C2C、B2B、B2C等介绍
O2O是online to offline分为四种运营模式: 1.online to offline是线上交易到线下消费体验 2.offline to online是线下营销到线上交易 3.offli ...
- 黑科技项目:英雄无敌III Mod <<Fallen Angel>>介绍
英雄无敌三简介(Heroes of Might and Magic III) 英3是1999年由New World Computing在Windows平台上开发的回合制策略魔幻游戏,其出版商是3DO. ...
- C# mvc DropDownList选中状态无效情况分析
情况: DropDownList控件使用List<SelectListItem>()设置下拉选项和默认值.当控件的Name和后台的ViewBag(或ViewData)的Key重复,会导致选 ...
- OpenSource.organization-in-github
1. gosquared https://github.com/gosquared 2. slack https://github.com/slackhq 3. The New York Times ...
- Openfire 集群探究_压测情况
一.(测试时间:20151220 - 下午14:00-17:00) windows环境 第一次测试,运行中发现在eclipse环境下.4w个连接耗尽了约1G的内存. 另外:服务本来可用的,压测客户端强 ...
- 操作系统win2003 x64的,安装OFFICE2003后,DCOM服务找不到 WORD应用程序服务
打开注册表,找到以下健值 HKEY_CLASSES_ROOT\AppID\{00020906-0000-0000-C000-000000000046} HKEY_CLASSES_ROOT\CLSID\ ...
- 设置secureCRT的鼠标右键为弹出文本操作菜单功能
options菜单下的 global options 页面的 terminal 中的 mouse 子菜单对 paste on right button 的选项取消勾选即可.
- ilspy导致c# dll代码被窃取
不得不放弃.net框架的任何开发!!!微软现在太蛋疼了!!! 不得不放弃.net框架的任何开发!!!微软现在太蛋疼了!!! 不得不放弃.net框架的任何开发!!!微软现在太蛋疼了!!! 不得不放弃.n ...
- SortedDictionary
对一个Dictionary<TKey, TValue>进行键排序可以直接用SortedDictionary SortedDictionary<TKey, TValue> 泛型类 ...