amplitude / experiment-ios-client

MIT License
2 stars 9 forks source link

Crash when user dictionary contains Date #42

Closed JanGorman closed 3 months ago

JanGorman commented 7 months ago

The experiment client crashes encoding JSON (on this line https://github.com/amplitude/experiment-ios-client/blob/main/Sources/Experiment/ExperimentClient.swift#L482) if the user dictionary contains a date:

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Invalid type in JSON write (__NSTaggedDate)'
*** First throw call stack:
(0x194afa69c 0x18cd8fc80 0x1939f2c70 0x1939f25c8 0x18e1251b0 0x18dea0ba0 0x1939f20c4 0x1939f25c8 0x18e1251b0 0x18dea0ba0 0x1939f20c4 0x193a26074 0x193a25f1c 0x10162c928 0x10162a1d4 0x101625e88 0x1015f8258 0x10cb9cf50 0x10cb9eb34 0x10cba698c 0x10cba7728 0x10cbb45f8 0x10cbb3c2c 0x1fea33964 0x1fea33a04)
libc++abi: terminating due to uncaught exception of type NSException
tyiuhc commented 7 months ago

@JanGorman, thanks for raising this issue. The date property should be passed as a string to avoid this issue.

JanGorman commented 7 months ago

That's what we ended up doing of course but it comes rather surprising and it's never cool if a third party crashes your app.

daltonclaybrook commented 4 months ago

My team is experiencing this issue as well. Has a fix for this been prioritized within Amplitude @tyiuhc?

tyiuhc commented 4 months ago

@JanGorman @daltonclaybrook, thank you for your patience on this. A fix for this is currently being worked on.

tyiuhc commented 4 months ago

@JanGorman @daltonclaybrook, this issue has been addressed in v1.13.5, please let us know if it is not behaving as expected, thanks!