I am fairly new to Xcode and swift. I am trying to send a notification from firebase to my app . Thanks Again
import Firebase
import FirebaseMessaging
import UserNotifications
import UIKit
class AppDelegate: UIResponder, UIApplicationDelegate, MessagingDelegate, UNUserNotificationCenterDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
Messaging.messaging().delegate = self
UNUserNotificationCenter.current().delegate = self
UNUserNotificationCenter.current().requestAuthorization(options:[.alert, .sound, .badge]) {success, _ in guard success else {
return
}
print("Success in APNS registry")
}
application.registerForRemoteNotifications()
return true
}
func messaging(_ messaging: Messaging, didReceiveRegistrationToken fcmToken: String?) {
messaging.token {token, _ in
guard let token = token else {
return
}
print("Token: (token)")
}
}
}