Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
确定UNNotificationResponse是否来自手表扩展或iOS应用程序_Ios_Swift_Apple Push Notifications - Fatal编程技术网

确定UNNotificationResponse是否来自手表扩展或iOS应用程序

确定UNNotificationResponse是否来自手表扩展或iOS应用程序,ios,swift,apple-push-notifications,Ios,Swift,Apple Push Notifications,使用func userNotificationCenter(center:UNUserNotificationCenter,didReceive response:UNNotificationResponse,withCompletionHandler completionHandler:@escaping()->Void)处理UNUserNotificationCenter委托中的位置通知时是否可以确定用户是使用watch应用程序还是在iOS设备上与通知交互 默认情况下,如果iOS应用程序的通

使用
func userNotificationCenter(center:UNUserNotificationCenter,didReceive response:UNNotificationResponse,withCompletionHandler completionHandler:@escaping()->Void)处理
UNUserNotificationCenter委托中的位置通知时
是否可以确定用户是使用watch应用程序还是在iOS设备上与通知交互

默认情况下,如果iOS应用程序的通知到达,则 WatchKit应用程序,系统将首先决定是否显示 在iPhone或Apple Watch上发出警报。如果 通知以“简短的外观”的形式发送给Apple Watch 首先显示通知场景。这包括应用程序 图标、通知中的标题和WatchKit应用程序的名称

看看这个


您还必须为iPhone和Watchkit实施UnuseNotificationCenterDelegate,并采取相应的措施。

您必须为iPhone和Watchkit实施两次UnuseNotificationCenterDelegate。iPhone和手表将分别收到通知。我建议你读这篇文章: