Created
July 13, 2015 18:14
-
-
Save lucianboboc/edac5e66b15569a89a1e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment