I read that you need to add the following lines to the didFinishLaunchingWithOptions method
if #available(iOS 10.0, *) { UNUserNotificationCenter.current().