UIApplication.registerForRemoteNotifications() must be called from main thread only

You can solve this issue with

DispatchQueue.main.async {
  UIApplication.shared.registerForRemoteNotifications()
}
Share