How can we switch off notification from device开发者_JAVA技巧?
Remote (Push) Notifications
If you are talking about remote (push) notifications, you can unregister for remote notifications using the - (void)unregisterForRemoteNotifications
method in UIApplication (see the class reference).
However, Apple notes that users can disable push notifications on their own:
You should call this method in rare circumstances only, such as when a new version of the application drops support for remote notifications. Users can temporarily prevent applications from receiving remote notifications through the Notifications section of the Settings application. Applications unregistered through this method can always re-register.
Local Notifications
If you're talking about local notifications, you can use the - (void)cancelLocalNotification:(UILocalNotification *)notification
or - (void)cancelAllLocalNotifications
methods, also on UIApplication (see the class reference).
精彩评论