Local notifications not adjusting for timezones

前端 未结 2 806
逝去的感伤
逝去的感伤 2021-02-09 11:47

I\'m scheduling a local notification with an NSDate with the time set to 9pm and am setting the notification\'s timezone to UTC/GMT.

If I set the device timezone to UTC

2条回答
  •  生来不讨喜
    2021-02-09 12:06

    See the documentation of the timeZone property of UILocalNotification:

    ... If you assign a valid NSTimeZone object to this property, the fire date is interpreted as a wall-clock time that is automatically adjusted when there are changes in time zones; an example suitable for this case is an an alarm clock.

    So I assume that if you want an absolute time for the notification, you must not assign a time zone.

提交回复
热议问题