Scheduling the Delivery of Local Notifications

  Apps can use local notifications to display alerts, play sounds, badge the app’s icon, or a combination of the three. For example, an alarm clock app might use local notifications to play an alarm sound and display an alert to disable the alarm. When a notification is delivered to the user, the user must decide if the information warrants bringing the app back to the foreground. (If the app is already running in the foreground, local notifications are delivered quietly to the app and not to the user.)

  Your own apps can have no more than 128 local notifications active at any given time, any of which can be configured to repeat at a specified interval.

 // Listing 3-4  Scheduling an alarm notification
- (void)scheduleAlarmForDate:(NSDate*)theDate
{
UIApplication* app = [UIApplication sharedApplication];
NSArray* oldNotifications = [app scheduledLocalNotifications]; // Clear out the old notification before scheduling a new one.
if ([oldNotifications count] > )
[app cancelAllLocalNotifications]; // Create a new notification.
UILocalNotification* alarm = [[UILocalNotification alloc] init];
if (alarm)
{
alarm.fireDate = theDate;
alarm.timeZone = [NSTimeZone defaultTimeZone];
alarm.repeatInterval = ;
alarm.soundName = @"alarmsound.caf";
alarm.alertBody = @"Time to wake up!"; [app scheduleLocalNotification:alarm];
}
}

Scheduling the Delivery of Local Notifications的更多相关文章

  1. 【Ionic】---Using Local Notifications In Your Ionic Framework App

    Using Local Notifications In Your Ionic Framework App 配置好ng-cordova先 <script src="lib/ngCord ...

  2. UIkit框架介绍

    UIKit Framework The UIKit framework (UIKit.framework) provides crucial infrastructure for implementi ...

  3. iOS 10.0 更新点(开发者视角)

    html, body {overflow-x: initial !important;}html { font-size: 14px; } body { margin: 0px; padding: 0 ...

  4. WWDC 2016: Rich Notifications in iOS 10

    Notifications have gotten more than a visual refresh in iOS 10. As part of the new UserNotifications ...

  5. iOS 中的Push Notifications简单实现(APNS)

    Android中的通知只有一种,就是Local Notifications,而iOS中除了Local Notifications外,还有一种Push Notifications.ios的这2种noti ...

  6. Thread Pool Engine, and Work-Stealing scheduling algorithm

    http://pages.videotron.com/aminer/threadpool.htm http://pages.videotron.com/aminer/zip/threadpool.zi ...

  7. (转)Apple Push Notification Services in iOS 6 Tutorial: Part 1/2

    转自:http://www.raywenderlich.com/32960/apple-push-notification-services-in-ios-6-tutorial-part-1 Upda ...

  8. SAP BAPI一览 史上最全

    全BADI一览  List of BAPI's       BAPI WG Component Function module name Description Description Obj. Ty ...

  9. ios程序后台运行设置(不是太懂)

    文一 我从苹果文档中得知,一般的应用在进入后台的时候可以获取一定时间来运行相关任务,也就是说可以在后台运行一小段时间. 还有三种类型的可以运行在后以, 1.音乐 2.location 3.voip 文 ...

随机推荐

  1. FastAdmin 开发时如何与官方同步升级

    FastAdmin 开发时如何与官方同步升级 使用 FastAdmin 开发时为了与官方同步升级,推荐使用 git 管理代码. 官网上提供的完整包是为了方便第一次使用的人快速测试. 我一般是给官方的 ...

  2. 【转】linux sed命令详解

    原文网址:http://www.iteye.com/topic/587673 1. Sed简介sed 是一种在线编辑器,它一次处理一行内容.处理时,把当前处理的行存储在临时缓冲区中,称为“模式空间”( ...

  3. boost::threadpool 调用类成员变量并传入参数 的方法

    1. 首先到官网下载   http://threadpool.sourceforge.net/   2. 包含头文件   #include "../boost/threadpool.hpp& ...

  4. request 里面参数设置 (有空瞄下)

    Requests 是用python语言编写的第三方库,基于 urllib,采用 Apache2 Licensed 开源协议的 HTTP 库.它比 urllib 更加方便,完全满足 HTTP 测试需求, ...

  5. Bootstrap-Plugin:警告框(Alert)插件

    ylbtech-Bootstrap-Plugin:警告框(Alert)插件 1.返回顶部 1. Bootstrap 警告框(Alert)插件 警告框(Alert)消息大多是用来向终端用户显示诸如警告或 ...

  6. springboot的interceptor(拦截器)的应用

    一.SpringMVC 中的Interceptor 拦截器也是相当重要和相当有用的,它的主要作用是拦截用户的请求并进行相应的处理.在web开发中,拦截器是经常用到的功能.它可以帮我们验证是否登陆.预先 ...

  7. Waiting for device dev/disk/by-id/ata-...-part2 to appear

    问题: 平台:Oralce VM Virtualbox的虚拟机Opensuse11.4 导出该机器的OVA文件后,把该OVA文件导入虚拟机,开机启动时报如下错误: Trying manual resu ...

  8. 七.jQuery源码解析之.toArray()

    toArray()是将jQuery对象转换成数组 从源码中可以看到,这些常见的方法,都是直接从原生的 javascript中"借鉴"过来的.为什么这么说呢? 225行中,在运行时, ...

  9. varnish/squid/nginx cache 有什么不同?

    SQUID 是功能最全面的,但是架构太老,性能不咋的Varnish 是内存缓存,速度一流,但是内存缓存也限制了其容量,缓存页面和图片一般是挺好的Nginx 本来是反向代理/web服务器,用了插件可以做 ...

  10. django-model的元类Meta

    Meta类存在model类里面 模型元选项 文档有更多Meta类的配置属性: English:https://docs.djangoproject.com/en/1.11/ref/models/opt ...