ios push local notification
UILocalNotification* localNotification = [[UILocalNotification alloc]init];
localNotification.alertBody = @"this is a local notification";
localNotification.soundName = UILocalNotificationDefaultSoundName;
//schedule the time to push local notification
NSCalendar* calendar = [NSCalendar autoupdatingCurrentCalendar];
NSDate* currentDate = [NSDate date];
NSDateComponents* currentDateComponents = [calendar components:NSYearCalendarUnit|NSMonthCalendarUnit|NSDayCalendarUnit|NSHourCalendarUnit|NSMinuteCalendarUnit|NSSecondCalendarUnit fromDate:currentDate];
NSDateComponents* scheduledDateComponents = currentDateComponents;
if (currentDateComponents != nil) {
[scheduledDateComponents setDay:currentDateComponents.day + 7];
[scheduledDateComponents setHour:17];
[scheduledDateComponents setMinute:0];
[scheduledDateComponents setSecond:0];
}
NSDate* scheduledDate = [calendar dateFromComponents:scheduledDateComponents];
localNotification.fireDate = scheduledDate;
[[UIApplication sharedApplication]cancelAllLocalNotifications];
[[UIApplication sharedApplication]scheduleLocalNotification:localNotification];
/////SIMPLE WAY
http://stackoverflow.com/questions/10060578/uilocalnotification-fires-immediately-instead-of-at-scheduled-time
UILocalNotification* localNotification = [[UILocalNotification alloc] init];
localNotification.fireDate = [NSDate dateWithTimeIntervalSinceNow:1];
localNotification.alertBody = @"Your alert message";
localNotification.timeZone = [NSTimeZone defaultTimeZone];
[[UIApplication sharedApplication] scheduleLocalNotification:localNotification];
ios push local notification的更多相关文章
- iOS 远程通知(Remote Notification)和本地通知(Local Notification)
ios通知分为远程通知和本地通知,远程通知需要连接网络,本地通知是不需要的,不管用户是打开应用还是关闭应用,我们的通知都会发出,并被客户端收到 我们使用远程通知主要是随时更新最新的数据给用户,使用本地 ...
- iOS - Push 通知推送
1.UserNotifications 通知是 App 用来和用户交流的一种方式,特别是当 App 并没有在前台运行的时候.通知,正如它的名称所强调的,被用作向用户'通知'一个事件,或者仅仅向用户提示 ...
- iOS Push详述,了解一下?
WeTest 导读 本文主要对iOS Push的在线push.本地push及离线(远程)push进行梳理,介绍了相关逻辑,测试时要注意的要点以及相关工具.小小的Push背后蕴藏着大大的逻辑! Push ...
- 了解iOS消息推送一文就够:史上最全iOS Push技术详解
本文作者:陈裕发, 腾讯系统测试工程师,由腾讯WeTest整理发表. 1.引言 开发iOS系统中的Push推送,通常有以下3种情况: 1)在线Push:比如QQ.微信等IM界面处于前台时,聊天消息和指 ...
- 苹果推送(APNs)ios push小结
把app删除后就推送不成功了,可以看出deviceToken应该是设备+app来一起识别的,重新安装后仍然为同一个 简介 推送服务APNs(Apple Push Notification servic ...
- IOS PUSH 实践操作~~~~
1.推送过程简介 (1)App启动过程中,使用UIApplication::registerForRemoteNotificationTypes函数与苹果的APNS服务器通信,发出注册远 ...
- iOS push全方位解析(二)【译文】"——生成OpenSSL证书,Provisioning Profile
这是一篇来自raywenderlich的教程,内容翔实!结构简单透彻.讲解循序渐进.文章质量上乘!是一篇难的的博文!使用半瓶的英语水平翻译了一下: 1.[iOS push全方位解析](一) push的 ...
- Local Notification
大家都知道Push Notification,这个东西需要联网才可以用.iOS4起,苹果引入了一种可以在设备内部引发的notification.不需要复杂的服务器编程,或其他复杂的配置.这个技术就是L ...
- iOS push过去的时候界面不能完全退出
iOS push过去的时候界面不能完全退出 解决方法:设置self.view.backgroundcolor 1. initWithFrame方法是什么? initWithFrame方法用来初始化并 ...
随机推荐
- x86函数调用约定
以下摘自<IDA Pro>,貌似有一些细节之处没有交代清楚呢,需要进一步思考.实践. 了解栈帧的基本概念后,接下来详细介绍它们的结构.下面的例子涉及x86体系结构和与常见的x86编译器(如 ...
- 【转】每天一个linux命令目录
原文网址:http://www.cnblogs.com/peida/archive/2012/12/05/2803591.html 开始详细系统的学习linux常用命令,坚持每天一个命令,所以这个系列 ...
- springboot 知识点
---恢复内容开始--- 1springBoot项目引入方式, 1,继承自父 project (需要没有付项目才能用,一般我们的项目都会有 父 项目 所以 这种方式不推荐 ,记住有这种方式 就可以了) ...
- Angular 4 路由守卫
路由守卫 只有当用户已经登录并拥有某些权限时才能进入某些路由 一个有多个表单组成的向导,如注册流程,用户只有在当前组件的组件中填写了满足要求的信息才可以导航到下一个路由 当用户未执行保存操作而试图离开 ...
- URL中的hash(井号)
1.#的含义 #代表网页中的一个位置,其右边的字符,就是该位置的标识符.比如 http://www.example.com/index.html#print 就是代表index.html中的print ...
- vmware 安装 ios 苹果系统
我用的系统是win10... 一.所需软件: 1.下载并安装VMware Workstation Pro 12 密码:7ybc和序列号 密码是:bwm0 2.下载unlocker 203(for OS ...
- 关于 eclipse startexplorer插件 快速打开文件夹
转自:http://basti1302.github.io/startexplorer/ Just drag-and-drop the button to the Eclipse menu bar t ...
- Linux内存管理和应用
[作者:byeyear.首发于cnblogs,转载请注明.联系:east3@163.com] 本文对Linux内存管理使用到的一些数据结构和函数作了简要描述,而不深入到它们的内部.对这些数据结构和函数 ...
- chrome从版本55开始,不再支持设置网页内容编码
Hi Everyone, Chrome 55 has removed the Encoding menu and Chrome will do auto-encoding detection no ...
- SpringCloud之最大的坑
就一句话,controller里面的API方法千万不要夹@Bean,因为加了这个就变成预编译的了!!!!不能断点不能log!!!!!!当然,如果想项目启动就执行的话,那就加上这个.