gpt4 book ai didi

iphone - UILocalNotification 触发日期问题

转载 作者:行者123 更新时间:2023-11-29 04:08:28 25 4
gpt4 key购买 nike

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

我在应用程序中安排了下午 3:30 举行的事件,并将提醒设置为提前 1 小时。

在 2:30,警报出现(预期),但它表示该事件是现在。另一方面, native 警报显示该事件是在 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];

最佳答案

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

关于iphone - UILocalNotification 触发日期问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14812007/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com