Ios6 更新其内容的本地通知

Ios6 更新其内容的本地通知,ios6,uilocalnotification,Ios6,Uilocalnotification,代码: 缺陷: 如果我是对的,我会说,一旦这个本地通知“嵌入”到设备的内存中,它就会与创建的每个本地通知保持一致。我很抱歉,对吗?如果这是真的,我该如何处理这种情况?由于您使用了以下选项,通知警报将重复出现: -(void)viewWillDisappear:(BOOL)animated { NSCalendar *calendar = [NSCalendar currentCalendar]; NSDateComponents *components = [[NSDateCom

代码:

缺陷:


如果我是对的,我会说,一旦这个本地通知“嵌入”到设备的内存中,它就会与创建的每个本地通知保持一致。我很抱歉,对吗?如果这是真的,我该如何处理这种情况?

由于您使用了以下选项,通知警报将重复出现:

-(void)viewWillDisappear:(BOOL)animated
{
    NSCalendar *calendar = [NSCalendar currentCalendar];
    NSDateComponents *components = [[NSDateComponents alloc] init];

    [components setDay: 3];
    [components setMonth: 7];
    [components setYear: 2012];
    [components setHour: 21];
    [components setMinute: 21];
    [components setSecond: 30];
    [calendar setTimeZone: [NSTimeZone defaultTimeZone]];
    NSDate *dateToFire = [calendar dateFromComponents:components];


    UILocalNotification *noti =[[UILocalNotification alloc] init];
    noti.fireDate = dateToFire;
    noti.repeatInterval = kCFCalendarUnitDay;
    noti.soundName = @"chun.aiff";
    noti.alertBody = [NSString stringWithFormat:@"Personal balance: %i", -PB];

    [[UIApplication sharedApplication] scheduleLocalNotification:noti];
}
您的通知警报仅计划在您使用date to fire设置的日期发出,但警报将按您设置的天数间隔重复。 如果不想重复,请将其设置为nil

希望它能解决你的问题。
:)

我无法理解你所说的“坚持每一个本地通知”是什么意思。。。。你想处理什么样的情况???请解释一下……我正在测试我正在做的应用程序。我试着使用不同的火灾日期。现在,该应用程序每天都会推送数据,在我为测试设置的所有时刻。不只是,比如说,12:00:00。我确实希望它重复,但当用户希望它重复时。如果我在用户每次更改设置时都使用该代码,他/她将收到大量通知。
noti.repeatInterval = kCFCalendarUnitDay;