iOS10 推送最新特性研究

2020-01-17 21:54:51于丽

 delegate

<UNUserNotificationCenterDelegate> 

iOS10收到通知不再是在application: didReceiveRemoteNotification:方法去处理, iOS10推出新的代理方法,接收和处理各类通知(本地或者远程)


 - (void)userNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions))completionHandler {
  //应用在前台收到通知
  NSLog(@"========%@", notification);
}

- (void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void (^)())completionHandler {
  //点击通知进入应用
  NSLog(@"response:%@", response);
}

最后 

下一篇文章继续介绍关于富媒体推送的 UNNotificationServiceExtension 和 Notification content extension, 未完待续。。。


注:相关教程知识阅读请移步到IOS开发频道。