A similar question was asked here: Push Notification ON or OFF Checking in iOS (in obj-c)
I converted it to swift for you:
//if iOS 7
var types: UIRemoteNotificationType = UIApplication.sharedApplication().enabledRemoteNotificationTypes()
if types != .None
{
print(" Push Notification ON")
}
EDIT: You can also check which ios is being used by doing the following:
var iOSversion: String = UIDevice.currentDevice().systemVersion()
var prefix: String = iOSversion.componentsSeparatedByString(".").first!
var versionVal: Float = CFloat(prefix)!
if versionVal >= 8 {
if UIApplication.sharedApplication().currentUserNotificationSettings().types != .None {
print(" Push Notification ON")
}
else {
var msg: String = "Please press ON to enable Push Notification"
var alert_push: UIAlertView = UIAlertView(title: "Push Notification Service Disable", message: msg, delegate: self, cancelButtonTitle: "Cancel", otherButtonTitles: "Setting")
alert_push.tag = 2
alert_push.show()
print(" Push Notification OFF")
}
}
else {
var types: UIRemoteNotificationType = UIApplication.sharedApplication().enabledRemoteNotificationTypes()
if types != .None {
print(" Push Notification ON")
}
else {
var msg: String = "Please press ON to enable Push Notification"
var alert_push: UIAlertView = UIAlertView(title: "Push Notification Service Disable", message: msg, delegate: self, cancelButtonTitle: "Cancel", otherButtonTitles: "Setting")
alert_push.tag = 2
alert_push.show()
print(" Push Notification OFF")
}