1
Whereas you skipped the Push Notification configuration step in the project to display the permission notice, add the command below in the . Swift you want to treat the warning, this can be appDelegate.Swift or some controller:
func registrarUsuarioParaPushNotifications() {
UNUserNotificationCenter.current() // 1
.requestAuthorization(options: [.alert, .sound, .badge]) { // 2
granted, error in
print("Permission granted: \(granted)") // 3
}
}
Explanation of the above command:
Unusernotificationcenter handles all notifications related to App activities - Official documentation;
You invoke requestAuthorization(options:completionHandler:) to request authorization to display notifications. Past options indicate the type of notification you want your app to use. In the example, we are requesting alert, sound and badge - Official documentation
The Completion Handler receives a boleana in which it indicates if the authorship was successful. In this case, we are only printing the result;
If you need more details, I recommend reading this guide
this warning is precisely for the app to send the device id to the server and the server uses a service similar to the lambda of Amazon to send notifications anyway you have to create within the app a receiver to receive the notifications and show on screen or make a certain action.
– Jasar Orion
Post what you already have to the location. It gets easier to help you
– LMaker