AppsFlyerSDK / appsflyer-cordova-plugin

AppsFlyer plugin for Cordova
MIT License
37 stars 71 forks source link

iOS Terminating app due to uncaught exception 'NSInvalidArgumentException' #163

Closed francois-dibulo closed 3 years ago

francois-dibulo commented 3 years ago

Report

Plugin Version

6.2.4

cordova-plugin-appsflyer-sdk 6.2.42

Update: also tried 6.2.60

On what Platform are you having the issue?

ios

What did you do?

What did you expect to happen?

Event to be tracked. We use window.plugins.appsFlyer.logEvent()

What happened instead?

The app crashes as soon as we execute the window.plugins.appsFlyer.logEvent function in javascript:

- AppsFlyer Debug: handle deep link

-[NSNull objectForKeyedSubscript:]: unrecognized selector sent to instance 0x1dd34a8e0
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSNull objectForKeyedSubscript:]: unrecognized selector sent to instance 0x1dd34a8e0'

*** First throw call stack:
(0x18aa87128 0x19e79a480 0x18a996138 0x18aa89784 0x18aa8b9ac 0x104dbff7c 0x104dd7d48 0x106575334 0x106577fd8 0x10658b850 0x10657c1d8 0x10657d018 0x106588828 0x1d2cf95bc 0x1d2cfc86c)
libc++abi: terminating with uncaught exception of type NSException

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSNull objectForKeyedSubscript:]: unrecognized selector sent to instance 0x1dd34a8e0'
terminating with uncaught exception of type NSException

Please provide any other relevant information.

App crashes on ios 14.4.2 and 14.5

Thank you for any help!

francois-dibulo commented 3 years ago

I believe I found the issue.

Previously we used trackEvent like this

  window.plugins.appsFlyer.trackEvent(eventName);

We didn't pass the eventValues param. Doing it with the new logEvent breaks it:

  window.plugins.appsFlyer.logEvent(eventName);

This doesn't break:

  window.plugins.appsFlyer.logEvent(eventName, {});

So if eventValues is undefined, then the app crashes