本地推送UILocalNotification的一些简单方法
1.添加本地推送,需要在app添加推送。可以根据通知的userInfo的不同的键值对来区分不同的通知
UILocalNotification *notification = [[UILocalNotification alloc] init];
if(notification)
{
notification.fireDate = [NSDate dateWithTimeIntervalSinceNow:5.0]; // 通知触发事件的时间
// notification.repeatInterval = 2; // 循环次数
// notification.repeatCalendar=[NSCalendar currentCalendar];//当前日历,使用前最好设置时区等信息以便能够自动同步时间
notification.alertBody = @"推送第2次测试";
notification.alertAction=@"打开应用"; //待机界面的滑动动作提示 notification.applicationIconBadgeNumber=;//应用程序图标右上角显示的消息数
// notification.alertLaunchImage=@"Default";//通过点击通知打开应用时的启动图片,这里使用程序启动图片
// notification.soundName=UILocalNotificationDefaultSoundName;//收到通知时播放的声音,默认消息声音
// notification.soundName=@"msg.caf";//通知声音(需要真机才能听到声音) //设置用户信息
notification.userInfo=@{@"id":@,@"user":@"This is a test!"};//绑定到通知上的其他附加信息 // 调用通知
[[UIApplication sharedApplication] scheduleLocalNotification:notification];
}
2.移除本地通知,在不需要此通知时记得移除
[[UIApplication sharedApplication] cancelAllLocalNotifications];
2.在AppDelegate中的- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification 为收到本地通知的回调方法
本地推送UILocalNotification的一些简单方法的更多相关文章
- 本地推送UILocalNotification(转)
1.增加一个本地推送 //设置20秒之后 NSDate *date = [NSDate dateWithTimeIntervalSinceNow:]; //chuagjian一个本地推送 UILoca ...
- 本地推送UILocalNotification
//本地推送---无需网络,由本地发起 UILocalNotification *localNotification = [[UILocalNotification alloc]init]; //设置 ...
- Swift - 推送之本地推送(UILocalNotification)添加Button的点击事件
上一篇讲到的本地推送是普通的消息推送,本篇要讲一下带按钮动作的推送消息 import UIKit @UIApplicationMain class AppDelegate: UIResponder, ...
- Swift - 推送之本地推送(UILocalNotification)
// 本地推送通知是通过实例化UILocalNotification实现的.要实现本地化推送可以在AppDelegate.swift中添加代码实现,本事例是一个当App进入后台时推送一条消息给用户. ...
- SWIFT推送之本地推送(UILocalNotification)之二带按钮的消息
上一篇讲到的本地推送是普通的消息推送,本篇要讲一下带按钮动作的推送消息,先上个图瞅瞅: 继上一篇的内容进行小小的改动: 在didFinishLaunchingWithOptions方法内进行以下修改 ...
- SWIFT推送之本地推送(UILocalNotification)
本地推送通知是通过实例化UILocalNotification实现的.要实现本地化推送可以在AppDelegate.swift中添加代码实现,本事例是一个当App进入后台时推送一条消息给用户. 1.首 ...
- iOS的本地推送删除不了解决方法
最近在研究苹果推送,当测试本地推送的时候,发现一个问题,就是一旦你添加了一个本地推动的通知,当你修改代码,删除应用,当你再次运行app,它还是会在横幅上面弹出推送,尼玛怎么搞都删除不了,近乎崩溃了,开 ...
- cocos2d-x中本地推送消息
作者:HU 转载请注明,原文链接:http://www.cnblogs.com/xioapingguo/p/4038277.html IOS下很简单: 添加一条推送 void PushNotific ...
- [iOS 高级] iOS远程推送与本地推送大致流程
本地推送: UILocalNotification *notification=[[UILocalNotification alloc] init]; if (notification!=nil) { ...
随机推荐
- git 每次push都需要输入用户和密码
git remote -v origin https://github.com/userName/xx.git (fetch) origin https://github.com/userName/x ...
- Unable to locate Spring NamespaceHandler for XML schema namespace
1. 问题 本文将讨论Spring中最常见的配置问题 —— Spring的一个命名空间的名称空间处理程序没有找到. 大多数情况下,是由于一个特定的Spring的jar没有配置在classpath下,让 ...
- Haskell语言学习笔记(84)Concurrent
Control.Concurrent Prelude> import Control.Concurrent Prelude Control.Concurrent> Control.Conc ...
- Haskell语言练习
Monad inc n = Just (n + 1) add1 n = [n + 1] main = do print $ Nothing >> (Just 0) -- Nothing p ...
- openwrt中防暴力破解shell的脚本
原文:http://www.right.com.cn/forum/thread-124429-1-1.html 原理:1. snort做入侵检测是很好,但是太大太复杂,我们需要轻量化的操作.当对方进行 ...
- java Run to Line
在运行Java代码时, 选择运行 Run AS java , 出现 java Run to Line, 是因为程序还在运行,没有停止.在控制,点击右键.terminate 结束,在Run ...
- Excel 整个列数字转换成文本
选中该列----数据---分列----下一步---到步骤三----列数据格式---勾选"文本"---完成.
- 2017秋季面向对象程序设计(Java)教材、教学纲要、考核要求
教材简况 凯 S.霍斯特曼 (Cay S. Horstmann)(作者), 周立新(译者), Java核心技术(卷1):基础知识(原书第10版) , 2016年9月1出版 本书包括两卷,选做教材的是卷 ...
- Python str list to list
eg1: My csv data like this below,i wt count list nums 2018上,"['C', 'B', 'B', 'B', 'D', 'A', 'B' ...
- maven(二)基于intellij idea搭建ssm的maven项目结构
项目配置文件整合步骤 1.这里使用maven来引入项目所需要的jar包,所以也就不需要手动来管理jar包了. pom.xml 配置模板如下: <project xmlns="http: ...