Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/17.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
Swift 两个回调同时触发。iOS推送通知_Swift_Apple Push Notifications - Fatal编程技术网

Swift 两个回调同时触发。iOS推送通知

Swift 两个回调同时触发。iOS推送通知,swift,apple-push-notifications,Swift,Apple Push Notifications,我对firebase推送通知有问题。 当应用程序处于后台模式时,当按下按钮时,这两个功能同时调用 应用程序(应用程序:UIApplication,DidReceivereMotentification) userInfo:[AnyHashable:Any],fetchCompletionHandler completionHandler:@escaping(UIBackgroundFetchResult)->Void) func userNotificationCenter(center:UNU

我对firebase推送通知有问题。 当应用程序处于后台模式时,当按下按钮时,这两个功能同时调用

应用程序(应用程序:UIApplication,DidReceivereMotentification) userInfo:[AnyHashable:Any],fetchCompletionHandler completionHandler:@escaping(UIBackgroundFetchResult)->Void)

func userNotificationCenter(center:UNUserNotificationCenter, didReceive响应:UNNotificationResponse,withCompletionHandler completionHandler:@escaping()->Void){

当应用程序放弃这两个方法时

func userNotificationCenter(center:UNUserNotificationCenter, willPresent通知:未通知,withCompletionHandler completionHandler:@escaping(UNNotificationPresentationOptions)-> (无效){

应用程序(应用程序:UIApplication,DidReceivereMotentification) userInfo:[AnyHashable:Any],fetchCompletionHandler completionHandler:@escaping(UIBackgroundFetchResult)->Void)

我的问题是
为什么我们需要新的ios 10方法当DidReceivereMotentification每次调用时,我都在ios 10手机上进行了测试。

你可以同时使用它们。但结果出乎意料,你永远不知道它最终会在什么时候坏掉。它可能会在ios 10.3.2或ios 11或任何其他版本上坏掉。因此,如果可用(ios 10.0,*),最好有一个
{.}
为其和iOS设置条件并使用
UserNotifications
框架