每日UILocalNotification触发多次 [英] Daily UILocalNotification firing more than once

查看:50
本文介绍了每日UILocalNotification触发多次的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,我遇到一个奇怪的问题.实际上,我想安排每天的通知(每天仅一次)在8:00 AM.下面是我用于安排每日通知的代码.

Hello i am facing a weird kind problem. Actually i want to schedule a daily notification (only once a day) at 8:00 AM. Below is my code for scheduling daily notification.

NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[formatter setDateFormat:@"HH:mm"];
NSDate *date = [[NSDate alloc] init];
date = [formatter dateFromString:@"08:00"];
UILocalNotification *localNotification = [[UILocalNotification alloc] init];
localNotification.fireDate = date;
localNotification.timeZone=[NSTimeZone defaultTimeZone];
localNotification.alertBody = @"You just received a local notification";
localNotification.alertAction = @"View Details";
localNotification.soundName = UILocalNotificationDefaultSoundName;
localNotification.repeatInterval = NSDayCalendarUnit;
[[UIApplication sharedApplication] scheduleLocalNotification:localNotification];
[formatter release];
[date release];

我的问题是,我收到2条本地通知.一个在8:00 AM,另一个在10:00 AM.为什么我在10:00 AM收到通知.我仅将其安排在8:00 AM.我知道UILocalNotification库在大多数苹果设备上还有其他奇怪的问题/错误.我只想确认我的代码中是否存在某些错误,或者这是UILocalNotification Library的怪异行为.我不知道为什么Apple无法解决许多开发人员报告的有关UILocalNotification的问题.

My problem is, I receive 2 local notifications. One at 8:00 AM and other at 10:00 AM. Why i am getting notification at 10:00 AM. I am scheduling it at 8:00 AM only. I know UILocalNotification library have some other weird kind of problems/bugs on most of apple devices. I just want to confirm whether there is some mistake in my code or it is a weird behaviour of UILocalNotification Library. I dont know why Apple is not working on resolving the issues being reported by many developers about UILocalNotification.

注意:我正在使用Xcode 4.6和iOS 6.1

Note: I am using Xcode 4.6 and iOS 6.1

推荐答案

这将是

This would be the BEST link to get your answer.

这篇关于每日UILocalNotification触发多次的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆