Last active
September 11, 2016 16:41
-
-
Save suraphanL/1995737700353cfcf416a0482c2d9392 to your computer and use it in GitHub Desktop.
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 characters
//Registration | |
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool | |
UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .sound, .badge]) { (granted, error) in | |
// Enable or disable features based on authorization. | |
} | |
} | |
//UNAuthorizationOptions | |
public struct UNAuthorizationOptions : OptionSet { | |
public init(rawValue: UInt) | |
public static var badge: UNAuthorizationOptions { get } | |
public static var sound: UNAuthorizationOptions { get } | |
public static var alert: UNAuthorizationOptions { get } | |
public static var carPlay: UNAuthorizationOptions { get } | |
} | |
//Token Registration | |
UIApplication.shared().registerForRemoteNotifications() | |
func application(_ application: UIApplication, | |
didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) { | |
... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment