react-native-push-notification / ios

React Native Push Notification API for iOS.
MIT License
741 stars 285 forks source link

cancelAllLocalNotifications has been deprecated from iOS 10 #201

Closed Dallas62 closed 3 years ago

Dallas62 commented 3 years ago

Hi,

This issue refer to: https://github.com/zo0r/react-native-push-notification/issues/1716

The API of iOS "cancelAllLocalNotifications" has been deprecated from iOS 11, so it doesn't not work from iOS 11 or above.

Here the replacement method: https://developer.apple.com/documentation/usernotifications/unusernotificationcenter/1649509-removeallpendingnotificationrequ

This is also probably the case for: https://developer.apple.com/documentation/uikit/uiapplication?language=objc

cc @Naturalclar

Naturalclar commented 3 years ago

@Dallas62 thanks for the information! I'll add removeAllPendingNotificationRequests method for next version and deprecate cancelAllLocalNotifications method.

Naturalclar commented 3 years ago

I'll also work on other deprecated methods as well

Naturalclar commented 3 years ago

@Dallas62 I've added new methods that uses UNNotification instead of UILocalNotification in v1.7.0 :tada: I plan to remove the deprecated methods in the next major version of this repo. There will be some modification needed in the https://github.com/zo0r/react-native-push-notification side, just fyi :)

Dallas62 commented 3 years ago

Thanks for this changes! I will check that ASAP 😉

YaoHuiJi commented 3 years ago

Hi, @Dallas62 @Naturalclar thanks for your works. I have a question, when I build my app, I get warnings in file 'RNCPushNotificationIOS.h', is this ok?

'UILocalNotification' is deprecated: first deprecated in iOS 10.0 - Use UserNotifications Framework's UNNotificationRequest

'UIUserNotificationSettings' is deprecated: first deprecated in iOS 10.0 - Use UserNotifications Framework's UNNotificationSettings

"@react-native-community/push-notification-ios": "^1.8.0" "react-native-push-notification": "^7.4.0"