繁体   English   中英

为什么 Apple Watch 的本地通知会延迟?

[英]Why are Apple Watch's local notifications delayed?

我为 Apple Watch 创建了一个应用程序,并为 iPhone 提供了一个配套应用程序。 这两个应用程序测试两个设备上的本地通知。

但是由于我更新到 iOS 13.1.2 和 WatchOS 6.0.1,Apple 上的本地通知被延迟:当我按下手表上创建通知的按钮并退出应用程序时,不需要 5 秒即可显示通知,但大约 20 秒......当我将代码更改为 3 秒时,需要 16 秒才能显示。

这是 Apple Watch 上的新功能还是错误? 因为在 iPhone 上它可以毫无延迟地工作。

先感谢您:)

    // Configure the notification's payload.
    let content = UNMutableNotificationContent()
    content.title = NSString.localizedUserNotificationString(forKey: "Hello!", arguments: nil)
    content.body = NSString.localizedUserNotificationString(forKey: "Hello_message_body", arguments: nil)
    content.sound = UNNotificationSound.default

    // Deliver the notification in five seconds.
    let trigger = UNTimeIntervalNotificationTrigger(timeInterval: 5, repeats: false)
    let request = UNNotificationRequest(identifier: "FiveSecond", content: content, trigger: trigger) // Schedule the notification.
    let center = UNUserNotificationCenter.current()
    center.add(request) { (error : Error?) in
         if let theError = error {
             // Handle any errors
         }
    }

编辑:

我还注意到这种奇怪的行为:当我在 iPhone 上创建通知时,按下按钮然后将手机置于待机状态,以便将通知传送到 Apple Watch,通知在手表上 5 秒后正确显示!

我在手表上生成的本地通知中也注意到了这一点。 我已经生成了从 30 秒到 3 分钟(以 30 秒为增量)的通知,并且它们始终晚了大约 13 秒。 在 watchOS 6 之前,他们没有迟到。

我刚刚将我的 Apple Watch 更新到 WatchOS 6.1,是的……他们修复了这个错误:!! 现在本地创建的通知会准时触发:)

@JackieNBee 在 WatchOS 6.1 之后您是否再次遇到此问题。 目前在 WatchOS 8.1 上,手表上的本地日程通知延迟约 13 秒。 我也有我的手表应用程序作为我的 iPhone 应用程序的配套应用程序。

暂无
暂无

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

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