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. 常见web安全攻防总结

    Web 安全的对于 Web 从业人员来说是一个非常重要的课题 , 所以在这里总结一下 Web 相关的安全攻防知识,希望以后不要再踩雷,也希望对看到这篇文章的同学有所帮助.今天这边文章主要的内容就是分析 ...

  2. 解决内部元素onMouseOver/onMouseOut事件冒泡触发父元素的相应事件

    前阵子为BS项目模板做了一个左侧滑动信息栏,效果类似于windows状态栏的自动隐藏效果,鼠标移进滑出,鼠标移出隐藏,浮动时不占用空间,也可以固定住占一块位置.做的过程中遇到一个问题,鼠标在信息栏内部 ...

  3. HP-Mercury SiteScope安装及监控Weblogic操作

    1.Mercury SiteScope简介Mercury SiteScope是一款无代理监测解决方案,可确保分布式IT基础架构——如服务器.操作系统.网络设备.网络服务.应用和应用组件的可用性和性能. ...

  4. Firefox渗透插件—Web渗透必备工具

    1:Firebug Firefox的 五星级强力推荐插件之一,不许要多解释 2:User Agent Switcher 改变客户端的User Agent的一款插件 3:Hackbar 攻城师们的必备工 ...

  5. 2.运行成功的Demo(Python+Appium)

    1.打开Appium运行 2.在Pycharm输入代码如下所示: from appium import webdriver desired_caps = {} #初始化 desired_caps['p ...

  6. ddt数据驱动

    数据驱动原理 1.测试数据为多个字典的list类型 2.测试类前加修饰@ddt.ddt 3.case前加修饰@ddt.data() 4.运行后用例会自动加载成三个单独的用例 5.测试结果: Testi ...

  7. VS2017如何配置openGL环境

    转自:http://blog.csdn.net/qq_26982531/article/details/62056913 这里着重介绍vs2017配置openGL环境与以前版本的不同之处:       ...

  8. CentOS 6 & 7 忘记root密码的修改方法

    https://www.linuxidc.com/Linux/2018-01/150211.htm

  9. Java HashMap 遍历方式探讨

    JDK8之前,可以使用keySet或者entrySet来遍历HashMap,JDK8中引入了map.foreach来进行遍历. keySet其实是遍历了2次,一次是转为Iterator对象,另一次是从 ...

  10. 给iOS开发新手送点福利,简述UIPageControl的属性和用法

    UIPageControl 1.   numberOfPages // 设置有多少页 默认为0 [pageControl setNumberOfPages:kImageCount]; 2.   cur ...