当将iOS 10设置为React Native的构建目标时,我收到此错误
/Users/krishan/Projects/CandidApp/node_modules/react-native/Libraries/PushNotificationIOS/RCTPushNotificationManager.h:15:46:' UIUserNotificationSettings'不推荐使用:在iOS 10.0中首先弃用 - 使用UserNotifications Framework的UNNotificationSettings`
答案 0 :(得分:0)
而不是你可以使用“UserNotifications” 你只需导入它并使用它的两个委托方法如下:
func userNotificationCenter(center: UNUserNotificationCenter, willPresentNotification notification: UNNotification, withCompletionHandler completionHandler: (UNNotificationPresentationOptions) -> Void) {
print(notification.request.content.userInfo)
}
@available(iOS 10.0, *)
func userNotificationCenter(center: UNUserNotificationCenter, didReceiveNotificationResponse response: UNNotificationResponse, withCompletionHandler completionHandler: () -> Void) {
print(response.notification.request.content.userInfo)
}