繁体   English   中英

UILocalNotification开火日期问题

[英]UILocalNotification Fire date issue

我正在使用UILocalNotification为我的应用程序中的日历事件安排警报

我已经在应用程序中安排了下午3:30的事件,并将警报设置为1小时前。

在2:30,警报出现了(预期),但表示该事件现在进行中。 另一方面,本机警报显示事件发生在1小时之后。

编辑:这是我如何安排通知:

        UILocalNotification *localNotification = [[[UILocalNotification alloc] init]autorelease];

        localNotification.fireDate = fireDate;


        localNotification.timeZone = [NSTimeZone defaultTimeZone];
        localNotification.alertBody = [NSString stringWithFormat: @"%@ \n%@ at: %@",title,todayString,[formatter stringFromDate:Startdate]];
        localNotification.alertAction = NSLocalizedString(@"Luanch", nil);

        NSMutableDictionary *dict = [[[NSMutableDictionary alloc] init] autorelease];

        [dict setObject:ID forKey:@"id"];
        [dict setObject:Startdate forKey:@"start"];
        [dict setObject:endDate forKey:@"end"];
        [dict setObject:[NSNumber numberWithInt:relativeOffset] forKey:@"offset"];
        localNotification.userInfo = dict;
        localNotification.soundName = UILocalNotificationDefaultSoundName;

        [[UIApplication sharedApplication] scheduleLocalNotification:localNotification];

仅本机警报在特定时间后显示事件,其他应用程序显示具有NOW标签的警报,因此无法从通知中心隐藏NOW标签。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM