ios - Apple Watch 中的本地通知

标签 ios swift apple-push-notifications

当 Apple Watch 应用程序在后台运行时,如何将本地通知从 iPhone 发送到 Apple Watch 应用程序?如果可能,您如何在模拟器中检查本地通知?

最佳答案

Apple Watch 上显示的通知与 iPhone 上显示的相同。

If you have your iPhone locked, notifications go to the Apple Watch also.

不能发送仅在 Apple Watch 上显示的通知。

As of Apple Docs:

Apple Watch takes full advantage of the existing interactive notification support on iOS. If your iOS app supports notifications, Apple Watch displays those notifications at appropriate times. When one of your app’s local or remote notifications arrives on the user’s iPhone, iOS decides whether to display that notification on the iPhone or on the Apple Watch. For notifications sent to Apple Watch, the system lets the user know subtly that a notification is available. If the user chooses to view the notification, the system displays an abbreviated version of the notification first, followed by a more detailed version. The user can dismiss the detailed notification, launch your Watch app, or act on the notification by tapping an available action button.

Apps are not required to do anything to support notifications. The system provides a default notification interface that displays the alert message from the notification. However, apps can customize the notification interface and include custom graphics, content, and branding.

关于ios - Apple Watch 中的本地通知,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35275271/

相关文章:

iOS:从 AVAudioRecorder 获取音频

ios - 增加MKMapView的最大缩放级别

xcode - 如何在swift中为数字添加逗号?

swift - 函数不会返回 true 除非我在需要它之前调用它一次

json - 打开应用程序时如何加载数据?

php - 具有多个应用程序的APNS推送服务器

iphone - 开发 iOS6 应用程序(iOS 7 就绪)

ios - Swift - 通过 API 调用将项目添加到数组

ios - 使用 CloudKit 延迟后触发推送通知

ios - userNotificationCenter 中的 completionHandler 实际上做了什么?