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. python 获取excel文件内sheet名称列表

    xl = pd.ExcelFile('foo.xls') xl.sheet_names # see all sheet names xl.parse(sheet_name) # read a spec ...

  2. CCNode的属性说明

    class CC_DLL CCNode : public CCObject { protected://属性列表 float m_fRotationX; ///x轴旋转角度 float m_fRota ...

  3. 如何重启 Windows 10 子系统(WSL) ubuntu

    如何重启 Windows 10 子系统(WSL) ubuntu WSL 子系统是基于 LxssManager 服务运行的. 只需要将 LxssManager 重启即可. 可以做成一个 bat 文件. ...

  4. UOJ 54 【WC2014】时空穿梭——莫比乌斯反演

    题目:http://uoj.ac/problem/54 想写20分. Subtask 2 就是枚举4个维度的值的比例,可算对于一个比例有多少个值可以选,然后就是组合数.结果好像不对. 因为模数太小,组 ...

  5. 控件m

    窗体的事件:删除事件:先将事件页面里面的挂好的事件删除,再删后台代码里面的事件 Panel是一个容器 1.Label -- 文本显示工具Text:显示的文字取值.赋值:lable1.Text 2.Te ...

  6. MongoDB 3.0 常见集群的搭建(主从复制,副本集,分片....)

      一.mongodb主从复制配置 主从复制是mongodb最常用的复制方式,也是一个简单的数据库同步备份的集群技术,这种方式很灵活.可用于备份,故障恢复,读扩展等. 最基本的设置方式就是建立一个主节 ...

  7. Pthreads 《并行程序设计导论》的补充代码

    ▶ 关于单链表的访问,插入结点和删除结点操作,并且将其推广到多线程中去. ● 代码,通用的随机数生成 // my_rand.h #ifndef _MY_RAND_H_ #define _MY_RAND ...

  8. python新里程

    为什么要学Python: 2018年6月开始自学Python.因为自己目前做Linux运维,感觉自己还需要掌握一门开发语言,在Java.python.php之间毫不犹豫的选择了Python,因为Pyt ...

  9. Sonar及其eclipse插件的安装 详细 http://www.importnew.com/10017.html

    参考:http://www.importnew.com/10017.html

  10. 42.国际化-配置package的资源文件

    转自:https://wenku.baidu.com/view/84fa86ae360cba1aa911da02.html 同样在建立com.asm包下建立两个资源文件(package级别的资源文件名 ...