After switching our iOS app project from Swift 5 to Swift 6 and publishing an update, we started seeing a large number of crashes in Firebase Crashlytics.
The crashes are triggered by NotificationCenter methods (post, addObserver, removeObserver) and show the following error:
BUG IN CLIENT OF LIBDISPATCH: Assertion failed: Block was expected to execute on queue [com.apple.main-thread (0x1f9dc1580)]
All scopes to related calls are already explicitly marked with @MainActor. This issue never occurred with Swift 5, but appeared immediately after moving to Swift 6.
Has anyone else encountered this problem? Is there a known solution or workaround?
Thanks in advance!