简体   繁体   中英

Can LocalNotifications be disabled by the user

I want to use UILocalNotifications as a background timer for an app. Can this notifications be disabled by the user like remote notifications? If the user disables remote notifications for the app, are the local notifications disabled to?

I finally wrote a test app to test this feature. The settings of "Notification" has no effect on local notifications. They will appear also while "Notifications" are completely disabled.

If you look closely at that page of Settings.app, you'll see it's called "Notification". No mention of local/remote. The two kinds of notification are actually designed to be indistinguishable to the user. So your settings in the Settings.app affect both types.

That said, I also think it's polite to give people the option of disabling them in my app itself. If a person opts out in the settings screen of my app, I either cancel all upcoming local notifications, or hit my server with some flag turning off remote notifications for this user. I also store that preference in NSUserDefaults so it can inform my notification-scheduling and apn-token-registering behavior on next launch.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM