Created
July 13, 2015 18:14
-
-
Save lucianboboc/edac5e66b15569a89a1e to your computer and use it in GitHub Desktop.
Revisions
-
lucianboboc created this gist
Jul 13, 2015 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,17 @@ 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") }