katzer / cordova-plugin-app-event

Cordova App-Event Plugin
Apache License 2.0
26 stars 23 forks source link

Crash on iOS 11 when postNotificationName is called from background thread #14

Open JanBrinker opened 6 years ago

JanBrinker commented 6 years ago

I came across this as I was using another one of your Cordova plugins, the local-notifications plugin.

On iOS 11 the plugin causes crashes (see other issues there: https://github.com/katzer/cordova-plugin-local-notifications/issues/1559) and I might just have stumbled across the issue, which seems to be within this plugin.

When I was trying to find out what's happening I saw some Xcode console output. It seems like

[[NSNotificationCenter defaultCenter] postNotificationName:aName object:anObject];

is executed on a background thread and this should be done on the main thread:

2018-04-09 21:45:53.735684+0200 MyApp[5914:28571855] [reports] Main Thread Checker: UI API called on a background thread: -[UIApplication registerUserNotificationSettings:]