Wootric / WootricSDK-iOS

Wootric iOS SDK to show NPS, CSAT and CES surveys
MIT License
13 stars 24 forks source link

Safely serialise update end user network response #84

Closed yusuf-a closed 1 year ago

yusuf-a commented 3 years ago

Issue

We have had crash reports from users from the Wootric SDK, specifically from the [WTRApiClient updateExistingEndUser:] method with the exception data parameter is nil (see screenshot attached). On further investigation by the team we discovered that unlike other network requests in WTRApiClient there is no check if there is an error before attempting to serialise the data. We believe this is why the app is crashing.

Solution Following the format of other network requests in WTRApiClient, we check to see if there is an error before attempting to serialise the data. If error is nonnull, then this error is logged. This should prevent the occurrence of the data parameter is nil exception.

Credit to @larromba for this solution.

Screenshot 2020-12-16 at 16 23 06
diegoserranoa commented 3 years ago

Hi @yusuf-a !

Thanks for bringing this up. Another customer found this bug and we're already working in the solution (it's just what you suggest). A new version should be coming up soon with the fix. We'll keep you updated!

yusuf-a commented 3 years ago

@diegoserranoa okay great! Thanks for the update!

vijayradke commented 1 year ago

@diegoserranoa I guess we can close this PR.

diegoserranoa commented 1 year ago

@vijayradke correct. We fixed this on version 0.21.1 https://github.com/Wootric/WootricSDK-iOS/blob/master/CHANGELOG.md#0211-2021-11-08

Thanks for reminding me of this!