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方法用来初始化并 ...
随机推荐
- Oracle 基础知识入门
前记: 近来项目用到Oracle数据库,大学学了点,后面基本忘记得差不多了,虽然基本语法跟sql 差不多,但是oracle知识是非常多的. 这里简单说点基础知识,希望后面补上更多的关于ORacle知识 ...
- Vue基础汇总实践
1)双向绑定: <div id="app"> <p>{{message}}</p> <input v-model=" ...
- nginx搭建负载均衡
负载均衡:针对web负载均衡简单的说就是将请求通过负债均衡软件或者负载均衡器将流量分摊到其它服务器. 负载均衡的分类如下图: 今天分享一下nginx实现负载均衡的实现,操作很简单就是利用了nginx的 ...
- GRUB 启动 WIN PE 镜像(ISO)
我用的这个WIN PE ISO只有 46M. 再大些的就没试过了. PE ISO 命名为 minipe.iso. 放在第一块硬盘的第二个分区. MENU.LST的内容. title WinPemap ...
- 我的Quartz笔记
代码: package com.smt.autorun; import java.io.File; import java.util.ArrayList; import java.util.Date; ...
- bzoj 4911: [Sdoi2017]切树游戏
考虑维护原树的lct,在上面dp,由于dp方程特殊,均为异或卷积或加法,计算中可以只使用fwt后的序列 v[w]表示联通子树的最浅点为w,且不选w的splay子树中的点 l[w]表示联通子树的最浅点在 ...
- Mac 配置多jdk 随意切换
1下载安装 jdk6:https://support.apple.com/kb/DL1572?locale=zh_CN 2配置环境变量 open .bash_profile export PATH=$ ...
- 杂项:BugFree
ylbtech-杂项:BugFree BugFree是借鉴微软的研发流程和Bug管理理念,使用PHP+MySQL独立写出的一个Bug管理系统.简单实用.免费并且开放源代码(遵循GNU GPL). 命名 ...
- 1116 Come on! Let's C (20 分)
1116 Come on! Let's C (20 分) "Let's C" is a popular and fun programming contest hosted by ...
- mongodb 怎样检测 安装成功 以及mongodb的一些增删改查命令
mongodb 主页 http://www.mongodb.org/ 1.先在网上下载一个mongodb的安装包,再打开cmd命令,找到你装mongodb的文件的路径,进到mongodb的文件下的li ...