func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
//here you have to put these line of code to confirm relevant delegate and to enable device for remote notification if device is still not given access for it
UIApplication.shared.registerForRemoteNotifications()
UNUserNotificationCenter.current().delegate = self
return true
}
1条答案
按热度按时间eufgjt7s1#
是的,您可以,首先您必须确认AppDelegate中的UNUserNotificationCenter.current().delegate
字符串
之后,你必须添加以下两个单独的方法来处理推送通知。
如果您设备iOS版本低于10.0,请使用此方法..
型
否则您可以使用此方法处理推送通知。
型