gpt4 book ai didi

ios - ScheduledLocalNotifications 显示错误的时区

转载 作者:行者123 更新时间:2023-11-29 03:11:34 24 4
gpt4 key购买 nike

我可以使用这段代码完美地在我的 TableView 中获取我的 scheduledLocalNotifications 列表;

NSArray *notificationArray = [[UIApplication sharedApplication] scheduledLocalNotifications];

但唯一的问题是,我的本地通知在正确的时间触发,但在列表中显示的时区错误。

我还使用 systemTimeZone 来安排我的本地通知,就像这样;

notification.timeZone = [NSTimeZone systemTimeZone];

获取具有正确时区的 scheduledLocalNotifications 列表的正确方法是什么?

提前致谢

最佳答案

当我已经安排了下午 3:30 的通知并且当我 NSLog 它是 fireDate 时它被正确安排时,它会显示在不同的时区,这就是我修复它的方法,我遇到了同样的问题。

[localNotification.fireDate descriptionWithLocale:NSGregorianCalendar]

这将返回带有公历本地的火灾日期(或者您应该使用在安排本地通知时使用的任何本地)

关于ios - ScheduledLocalNotifications 显示错误的时区,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22191239/

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