func unregisterForNotificationsForApp(){ let application = UIApplication.sharedApplication() application.unregisterForRemoteNotifications() NSUserDefaults.standardUserDefaults().setBool(false, forKey: "pushPermissions") } func registerForNotificationsForApp(){ let userNotificationTypes = (UIUserNotificationType.Alert | UIUserNotificationType.Badge | UIUserNotificationType.Sound); let device = CurrentDevice() let settings = UIUserNotificationSettings(forTypes: userNotificationTypes, categories: nil) let application = UIApplication.sharedApplication() application.registerUserNotificationSettings(settings) application.registerForRemoteNotifications() NSUserDefaults.standardUserDefaults().setBool(true, forKey: "pushPermissions") }