Last active
July 24, 2020 10:53
-
-
Save bossly/18da40edc6a3e746d0627cf3314adb69 to your computer and use it in GitHub Desktop.
APN configure for Firebase Cloud Messangers
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
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { | |
// CONFIGURE PUSH NOTIFICATION | |
let authOptions : UNAuthorizationOptions = [.alert, .badge, .sound] | |
UNUserNotificationCenter.current().requestAuthorization( | |
options: authOptions, | |
completionHandler: {_,_ in }) | |
UNUserNotificationCenter.current().delegate = self | |
application.registerForRemoteNotifications() // here your alert with Permission will appear | |
// CONFIGURE FIREBASE PROJECT | |
FirebaseApp.configure() | |
} | |
func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) { | |
Messaging.messaging().apnsToken = deviceToken | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment