Reputation: 3063
I want to make the function that turn off push notification off the app (at the setting page) by Uiswitch
How can i do it
Thanks!
Edited Add example photo
Upvotes: 3
Views: 5996
Reputation: 3389
From the application, it is near to impossible, but you can set your change your Service which send Push notification.
If you are using APNS
, than you must send Device token to your server, for send push notification.
You can make call to server for disable it with the device token you passed. You can make call on switch value change.
Upvotes: 2
Reputation: 3831
Use this ...
The first time a push-enabled app registers for push notifications, iOS asks the user if they wish to receive notifications for that app. Once the user has responded to this alert it is not presented again unless the device is restored or the app has been uninstalled for at least a day.
if types == UIRemoteNotificationType.None {}
UIApplication.sharedApplication().registerUserNotificationSettings(UIUserNotificationSettings(forTypes: UIRemoteNotificationType.Badge | UIRemoteNotificationType.Sound | UIRemoteNotificationType.Alert, categories: nil))
Upvotes: -1