Determine on iPhone if user has enabled local noti

2019-02-20 02:38发布

I'm looking for a way to determine if the user has, via settings, enabled or disabled their Local notifications for my application. Here I'm not using push notification

Thanks.

3条回答
该账号已被封号
2楼-- · 2019-02-20 02:44

you can find out what types of notifications the user has registered for by calling:

  [[UIApplication sharedApplication] enabledRemoteNotificationTypes];

which returns a bitmask based on UIRemoteNotificationType;

查看更多
一纸荒年 Trace。
3楼-- · 2019-02-20 02:45

Before iOS5.0 Local Notifications was always available.

Since iOS8.0 exists way to detect it is disabled by user or not: https://stackoverflow.com/a/26052687/751932

There are no public way to determine what you ask between iOS 5.0 to 8.0

查看更多
Animai°情兽
4楼-- · 2019-02-20 02:59

Set a test notification with a fireDate in 1 second. Check if it gets called in

(void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification)
查看更多
登录 后发表回答