I have an app where I have implemented push notifications. I check with the user to allow remote notifications with:
let settings = UIUserNotificationSetting
Updated with swift 4 :
func switchChanged(sender: UISwitch!) { print("Switch value is \(sender.isOn)") if(sender.isOn){ print("on") UIApplication.shared.registerForRemoteNotifications() } else{ print("Off") UIApplication.shared.unregisterForRemoteNotifications() } }