Guest User

Untitled

a guest
Mar 17th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. import UIKit
  2. import UserNotifications
  3.  
  4. @UIApplicationMain
  5. class AppDelegate: UIResponder, UIApplicationDelegate {
  6.  
  7. var window: UIWindow?
  8.  
  9. func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
  10.  
  11. //Assign the push delegate before didFinishLaunchingWithOptions completes
  12. UNUserNotificationCenter.current().delegate = PushManager.sharedInstance
  13.  
  14. PushManager.sharedInstance.registerForPushNotifications()
  15. return true
  16. }
  17.  
  18. func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
  19. PushManager.sharedInstance.didRegisterForRemoteNotifications(deviceToken: deviceToken)
  20. }
  21.  
  22. func application(_ application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: Error) {
  23. print("didFailToRegisterForRemoteNotificationsWithError: \(error)")
  24. }
  25.  
  26. }
Add Comment
Please, Sign In to add comment