iOS 本地通知 操作

1:配置通知:然后退出程序;

UILocalNotification *localNotif = [[UILocalNotification alloc] init];
localNotif.fireDate = date; // date after 10 sec from now
localNotif.timeZone = [NSTimeZone defaultTimeZone]; // Notification details
localNotif.alertBody = text; // text of you that you have fetched
// Set the action button
localNotif.alertAction = @"View"; localNotif.soundName = UILocalNotificationDefaultSoundName;
localNotif.applicationIconBadgeNumber = ; // Specify custom data for the notification
NSDictionary *infoDict = [NSDictionary dictionaryWithObject:@"someValue" forKey:@"someKey"];
localNotif.userInfo = infoDict; // Schedule the notification
[[UIApplication sharedApplication] scheduleLocalNotification:localNotif];

2:接收通知,打开操作

    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

// Override point for customization after application launch.

// Add the view controller's view to the window and display.
[window addSubview:viewController.view];
[window makeKeyAndVisible]; application.applicationIconBadgeNumber = ; // Handle launching from a notification
UILocalNotification *localNotif =
[launchOptions objectForKey:UIApplicationLaunchOptionsLocalNotificationKey];
if (localNotif) {
NSLog(@"Recieved Notification %@",localNotif);
} return YES;
} - (void)application:(UIApplication *)app didReceiveLocalNotification:(UILocalNotification *)notif {
// Handle the notificaton when the app is running
NSLog(@"Recieved Notification %@",notif);
}

参考:http://stackoverflow.com/questions/19357087/how-to-display-notifications-in-status-bar-using-dynamic-data-in-iphone

iOS 本地通知 操作的更多相关文章

  1. IOS 本地通知 UILocalNotification

    IOS 本地通知 UILocalNotification [本文章第四部分中的代码逻辑来自网上的借鉴,并非我自己原创] 大概一个月前,我开始跟着做IOS项目了.学习C++,了解Objective-C, ...

  2. IOS本地通知

        发送通知: UILocalNotification *newNotification = [[UILocalNotification alloc] init]; if (newNotifica ...

  3. IOS本地通知:UILocalNotification使用记录

    第一次接触IOS的本地通知的使用,看到别人写的一个比较详细的记录,自己整理过来,方便以后再次使用和拓展: 1.创建一个本地通知,添加到系统: // 初始化本地通知对象 UILocalNotificat ...

  4. IOS 本地通知

    操作流程 1.接收通知 2.注册发送通知 用途:提示时间,闹钟 //接收本地通知(在Appdelegate里面实现) - (void)application:(UIApplication *)appl ...

  5. xamarin.ios 本地通知推送

    由于ios10版本以后UILocalNotification被标为弃用了,所以要添加新的本地通知推送功能,下面提供一些代码参考. 一.先在AppDelegate.cs上注册本地通知推送功能. publ ...

  6. iOS: 本地通知的前后变化(iOS10)

    一.介绍  通知和推送是应用程序中很重要的组成部分.本地通知可以为应用程序注册一些定时任务,例如闹钟.定时提醒等.远程推送则更强大,提供了一种通过服务端主动推送消息到客户端的方式,服务端可以更加灵活地 ...

  7. IOS 本地通知推送消息

    在现在的移动设备中,好多应用性的APP都用到了推送服务,但是有好多推送的内容,比如有的只是单纯的进行推送一个闹钟类型的,起了提醒作 用,有的则是推送的实质性的内容,这就分为推送的内容来区别用什么推送, ...

  8. iOS(本地通知与远程通知)

    iOS 推送通知有两种:本地推送.远程推送. 本地推送 :  在不需要联网的情况下,由APP发出推送,常用于某一时刻的通知,如闹钟.本地通送有局限性在于当APP处于后台或者退出时就无法发出通知. 远程 ...

  9. IOS 本地通知UILocalNotification

    //发送通知    UILocalNotification *notification=[[UILocalNotification alloc] init];       if (notificati ...

随机推荐

  1. HNOI2012永无乡

    fhq treap+启发式合并,将小的合并到大的上面,复杂度NlogN. 最好的一点是通过dfs将一个子树内的元素转到另一个元素上. By:大奕哥 #include<bits/stdc++.h& ...

  2. 【20181027T3】山河令【DP套DP】

    原题 [错解] 一眼DP 哎好像能删成奇形怪状的 弃疗,主要是没时间了 [正解] 神仙DP 明显先设\(f(i,j)\)表示把\([i,j]\) 取完的最小代价 然后发现转移不了,因为可以拿很多块 但 ...

  3. HDU 6134 Battlestation Operational(莫比乌斯反演)

    [题目链接] http://acm.hdu.edu.cn/showproblem.php?pid=6134 [题目大意] 求$\sum_{i=1}^{n}{\sum_{j=1}^{i}\lceil{\ ...

  4. [转] 关于Struts-JSON配置(详解带实例struts2的json数据支持)

    关于Struts-JSON的提高开发效率 一.JSON是什么? :JSON(JavaScript Object Notation) 是一种轻量级的数据交换格式.易于人阅读和编写,同时也易于机器解 析和 ...

  5. LT1961 升压型稳压器造就了兼具升压和降压能力的扁平状SEPIC

    http://cds.linear.com/docs/cn/design-note/DN317%20sim_chs.pdf http://cds.linear.com/docs/en/datashee ...

  6. 采集音频和摄像头视频并实时H264编码及AAC编码[转]

    0. 前言 我在前两篇文章中写了DirectShow捕获音视频然后生成avi,再进行264编码的方法.那种方法有一些局限性,不适合实时性质的应用,如:视频会议.视频聊天.视频监控等.本文所使用的技术, ...

  7. Executing a system tool

    Executing a system tool The following code example shows the execution of the Buffer tool from the A ...

  8. Oracle经典查询案例

    1.创建一个学生管理数据库,名称为student 2.最少包括一下三张表 S (SNO,SNAME)学生关系.SNO 为学号,SNAME 为姓名 C (CNO,CNAME,CTEACHER)  课程关 ...

  9. python接口自动化23-token参数关联登录(登录拉勾网)

    前言 登录网站的时候,经常会遇到传token参数,token关联并不难,难的是找出服务器第一次返回token的值所在的位置,取出来后就可以动态关联了 登录拉勾网 1.先找到登录首页https://pa ...

  10. java集合(ArrayList,Vector,LinkedList,HashSet,TreeSet的功能详解)

    说起集合,我们会潜意识里想到另外一个与之相近的名词——数组,OK!两者确实有相似之处,但也正是这点才是我们应该注意的地方,下面简单列出了两者的区别(具体功能的不同学习这篇文章后就会明白了): 数组 长 ...