Enable or Disable Iphone Push Notifications inside the app

后端 未结 4 1404
终归单人心
终归单人心 2020-12-01 04:52

I have a iphone app which is enable to receive push notifications. Currently i can disable push notifications for my app by going to the iphone settings/Notifications.

4条回答
  •  不知归路
    2020-12-01 04:56

    First thing is that you can not enable and disable push notification in inside the app. If you have found some apps which did it than there must be workaround solution.

    Like if you want to do Inside the app then use one identifier and send it to server according push notification enable and disable button. So, your server side coding use this identifier and work according to that. Like identifier is say it's enable than your server will send notification otherwise not.

    You can check that user set enable or disable Push Notifications using following code.

    Enable or Disable Iphone Push Notifications

    UIRemoteNotificationType types = [[UIApplication sharedApplication] enabledRemoteNotificationTypes];
    if (types == UIRemoteNotificationTypeNone) 
     // Yes it is..
    

    Hope, this will help you..

提交回复
热议问题