Example call for this method would be:
After this
application:didRegisterForRemoteNotificationsWithDeviceToken:
will be calledNote: the callback with token is only called if the application has successfully registered for user notifications using the function above or if Background App Refresh is enabled.
You are now able to obtain silent notifications with by sending following payload.
When iOS receives such a notification, then it wakes up your app for seconds to fetch the new content. If you only want to send silent notifications, then no permissions will be asked from the user. But they can disable them by going to settings.
But notifications that appear still needs permission. If the payload sent is of type:
To present such type of notification you will have to register for user type notifications by calling registerForUserNotificationSettings:notificationSettings: method:
Part of the docs says, "If your app displays alerts, play sounds, or badges its icon while in the background, you must call this method during your launch cycle to request permission to alert the user in those ways."
Note: Presenting User type notifications asks for user's permission.