techaffinity / freshchat-phonegap

Freshchat sdk for phonegap
7 stars 36 forks source link

updateUserProperties crashes iOS WKWebView if used from 'resume' #48

Open JOldak opened 3 years ago

JOldak commented 3 years ago

Hi hi,

i don't know if this is actively maintained (hopefully so!). But I've found a bug. The plugin crashes with iOS/WKWebView if updateUserProperties is called from the 'resume' action.

The trace is like this:

0   libsystem_kernel.dylib          0x00000001b9c4d290 __ulock_wait + 8
1   libsystem_platform.dylib        0x00000001d6499dec _os_unfair_lock_lock_slow + 192
2   libobjc.A.dylib                 0x00000001a20f54ec objc_sync_enter + 32
3   MyAppName                   0x00000001031cdde0 +[FCDataManager sharedInstance] + 128
4   MyAppName                   0x00000001031d9fe8 -[Freshchat setUserProperties:] + 128
5   MyAppName                   0x00000001031da464 -[Freshchat setUserPropertyforKey:withValue:] + 220
6   MyAppName                   0x0000000102fe91ec -[FreshchatPlugin updateUserProperties:] + 496108 (FreshchatPlugin.m:227)
7   MyAppName                   0x000000010331a2fc -[CDVCommandQueue execute:] + 3842812 (CDVCommandQueue.m:182)
8   MyAppName                   0x0000000103106850 -[CDVWKWebViewEngine handleCordovaMessage:] + 1665104 (CDVWKWebViewEngine.m:616)

Though other functions such as updateUser work fine.

Looking at the code inside FreshchatPlugin.m for updateUserProperties, I suspect the problem is because it doesn't use runInBackground on the Freshchat sharedInstance - but rather calls it directly, and iOS gets rather upset about this!

Is there any chance of getting a fix for this?

Thanks

joe