I am trying to make a flutter app that uses APNS for iOS push notifications and I do not want to use firebase, as I am using AWS SNS in the backend to deliver the push notifications via APNS. I have the application Identifier set up and Keys generated from the apple developer portal. How can I get the APNS device token, I am stuck at this point, tried multiple things but none worked? Below is my AppDelegate.swfit code
import UIKit
import Flutter
@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
GeneratedPluginRegistrant.register(with: self)
UNUserNotificationCenter.current().delegate = self as UNUserNotificationCenterDelegate
UIApplication.shared.registerForRemoteNotifications()
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
func application(_ application: UIApplication,
didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data)
{
let hexString = map { deviceToken(format: "%02.2hhx", $0)}.joined()
print(hexString)
}
}