iOS关于本地推送
2014-11-30 14:05
295 查看
不多说 直接上代码
NSDate *now = [NSDate date]; UILocalNotification *reminderNotification = [[UILocalNotification alloc] init]; // 本地消息的时间间隔 [reminderNotification setFireDate: [now dateByAddingTimeInterval: 10]]; // 重复间隔 会在1分钟后重复提醒,并在提醒后的下句指定时间再次提醒 即使App退出 依然会提醒 骚扰必备.... [reminderNotification setRepeatInterval: NSCalendarUnitSecond]; // 时区 [reminderNotification setTimeZone: [NSTimeZone localTimeZone]]; // 本地推送的消息内容 [reminderNotification setAlertBody: @"本地推送测试"]; // 在锁屏时,会显示"滑动来"+Action内容 无此句则为默认:滑动查看 [reminderNotification setAlertAction: @"启动"]; // 推送时的声音 [reminderNotification setSoundName: UILocalNotificationDefaultSoundName]; // 增加应用图标badge [reminderNotification setApplicationIconBadgeNumber: 1]; //设置随Notification传递的参数 NSDictionary *infoDict = [NSDictionary dictionaryWithObjectsAndKeys:@"reminder", @"notificationId", nil]; reminderNotification.userInfo = infoDict; // 注册本地推送 [[UIApplication sharedApplication] scheduleLocalNotification: reminderNotification];
相关文章推荐
- 关于iOS本地推送的那些事儿
- iOS关于本地推送通知的简单用法
- 关于iOS 本地推送的知识二三点
- 关于iOS 9之前的本地推送,本地推送杀掉进程后到底能不能收到?
- ios推送:本地通知UILocalNotification
- iOS 推送,证书申请,本地推送
- 个人关于iOS推送通知优化的概念
- 个人关于iOS推送中心优化的概念
- ios 本地推送的添加和取消
- Ios关于推送消息的处理
- 关于ios 推送功能的终极解决
- 关于iOS推送通知前端需要的操作
- iOS推送:实现本地推送
- IOS 本地推送通知方法
- iOS推送:实现本地推送
- IOS本地推送
- ios本地推送方法
- iOS推送:实现本地推送
- ios 关于推送发布的一些流程
- iOS推送:实现本地推送