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.

  1. // Listing 3-4 Scheduling an alarm notification
  2. - (void)scheduleAlarmForDate:(NSDate*)theDate
  3. {
  4. UIApplication* app = [UIApplication sharedApplication];
  5. NSArray* oldNotifications = [app scheduledLocalNotifications];
  6.  
  7. // Clear out the old notification before scheduling a new one.
  8. if ([oldNotifications count] > )
  9. [app cancelAllLocalNotifications];
  10.  
  11. // Create a new notification.
  12. UILocalNotification* alarm = [[UILocalNotification alloc] init];
  13. if (alarm)
  14. {
  15. alarm.fireDate = theDate;
  16. alarm.timeZone = [NSTimeZone defaultTimeZone];
  17. alarm.repeatInterval = ;
  18. alarm.soundName = @"alarmsound.caf";
  19. alarm.alertBody = @"Time to wake up!";
  20.  
  21. [app scheduleLocalNotification:alarm];
  22. }
  23. }

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. 升级到SQL Server 2012/2014时一些需要考虑的事项

    1. 使用Upgrade Adviser评估升级前需要解决的事情. https://msdn.microsoft.com/zh-cn/library/ms144256(v=sql.110).aspx ...

  2. 对Linux内核中进程上下文和中断上下文的理解

    内核空间和用户空间是操作系统理论的基础之一,即内核功能模块运行在内核空间,而应用程序运行在用户空间.现代的CPU都具有不同的操作模式,代表不同的 级别,不同的级别具有不同的功能,在较低的级别中将禁止某 ...

  3. PCB 设计文件中哪些可以不做成元件

    PCB 文件中哪些可以不做成元件 在 PCB 设计时有些元件为了快速,实际并不需要做成元件. 因为做成元件会浪费时间,并且生产时也没有实际的元件. 如下(持续更新): PCB 与 PCB 之前的连接人 ...

  4. GPU 服务器环境安装中一些基础note

    GPU 服务器环境安装中一些基础note GPU 服务器: 添加组,用户,并为之新建主目录. c302@c302-dl:~$ sudo addgroup testgroup Adding group ...

  5. php 取数组最后一个元素

    可以用end()函数取出数组的最后一个元素, $rList = array( array('id'=>1,'txt'=>'a'), array('id'=>2,'txt'=>' ...

  6. Angular 安装

    1.angular安装 npm  install -g angular 2. 显示angular安装路径 npm config ls 3. angular 双向绑定 <!DOCTYPE html ...

  7. Python笔试题&面试题总结

    黑色加粗的是笔试题,蓝色是面试题 1.什么是GIL 2.Python中的@staticmethod和@classmethod的区别 (**) 3.Python里面如何拷贝一个对象,并解析深浅拷贝 4. ...

  8. HR-人力资源管理系统(Human Resources Management System,HRMS)

    人力资源管理系统(Human Resources Management System,HRMS),是指组织或社会团体运用系统学理论方法,对企业的人力资源管理方方面面进行分析.规划.实施.调整,提高企业 ...

  9. [转][javascript]判断传入参数

    // IE 下 name 都是 undefined ,这里手动赋值 Number.name="Number"; //String.name="String"; ...

  10. MySql存储过程简单实例

    转自:http://www.cnblogs.com/zhuawang/p/4185302.html ********************* 创建表 ************************ ...