gpt4 book ai didi

ios - 重复间隔对于本地通知无法正常工作 (Swift)

转载 作者:搜寻专家 更新时间:2023-11-01 07:27:30 25 4
gpt4 key购买 nike

<分区>

无论我将其设置为什么,我的重复间隔大约每 60 秒关闭一次。这是我的代码。此外,只要它每 60 秒重复一次,就会同时发出两个通知。为了阐明我想要做什么,我希望我的通知每周发出一次,以提醒我的 sprite kit 游戏的玩家回来玩。

    let localNotification = UILocalNotification() // Creating an instance of the notification.
localNotification.alertTitle = "Title"
localNotification.alertBody = "Body"
localNotification.alertAction = "Launch"
localNotification.repeatInterval = .Hour
localNotification.timeZone = NSTimeZone.defaultTimeZone()
localNotification.soundName = UILocalNotificationDefaultSoundName // Use the default notification tone/ specify a file in the application bundle
localNotification.applicationIconBadgeNumber = 1 // Badge number to set on the application Icon.
localNotification.fireDate = NSDate(timeIntervalSinceNow: 5)
UIApplication.sharedApplication().scheduleLocalNotification(localNotification) // Scheduling the notification.

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