exponea / exponea-ios-sdk

MIT License
20 stars 29 forks source link

UIApplication.shared.registerForRemoteNotifications() is called on a background thread #16

Closed sgrgrsn closed 4 years ago

sgrgrsn commented 4 years ago

The Main Thread Checker is complaining about the UIApplication.shared.registerForRemoteNotifications() is being called from a background thread. According to the stack trace I can see it's being called from the callback after checking if the UNNotificationCenter is authorized (UNAuthorizationStatusProvider.current.isAuthorized).

I found this piece in the PushNotificationManager where you call the UIApplication.shared.registerForRemoteNotifications() in the completion handler. This is not guaranteed to be called on the Main Thread so it should be wrapped in a DispatchQueue.main.async {} or similar.

From Xcode: CleanShot 2020-07-22 at 12 57 35

wassil commented 4 years ago

That makes sense, added to our backlog.

Thank you for your report

wassil commented 4 years ago

Issue has been fixed as part of our 2.8.0 release.

Thanks again for reporting!