[使用UNUserNotificationCenterDelegate
在func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void)
中处理位置通知时,可以确定用户是否通过手表应用程序或在iOS设备上与通知进行了交互?
默认情况下,如果通知通知带有随播广告的iOS应用WatchKit应用,系统将首先决定是否显示在iPhone或Apple Watch上发出警报。如果通知以“短视”形式发送到Apple Watch通知场景将首先显示。这由应用程序组成图标,通知标题和WatchKit应用名称]
签出此tutorial
您还必须为iPhone和Watchkit都实现UNUserNotificationCenterDelegate,并采取相应的措施。