Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import UIKit
- import UserNotifications
- @UIApplicationMain
- class AppDelegate: UIResponder, UIApplicationDelegate {
- var window: UIWindow?
- func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
- //Assign the push delegate before didFinishLaunchingWithOptions completes
- UNUserNotificationCenter.current().delegate = PushManager.sharedInstance
- PushManager.sharedInstance.registerForPushNotifications()
- return true
- }
- func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
- PushManager.sharedInstance.didRegisterForRemoteNotifications(deviceToken: deviceToken)
- }
- func application(_ application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: Error) {
- print("didFailToRegisterForRemoteNotificationsWithError: \(error)")
- }
- }
Add Comment
Please, Sign In to add comment