Skip to content

setEndUserProperties crashes on iOS when passing numbers #38

Description

@TuurDutoit

When upgrading from v1.5.5 to v1.8.0, we started to receive crash reports from iOS devices.

Error & trace (simplified):

-[__NSCFNumber length]: unrecognized selector sent to instance 0x9758168da1f05135
#8	0x1053625f0 in -[WTRApiClient requestWithHost:path:HTTPMethod:queryItems:] at /Users/tuur/Projects/mobile/frontend/ios/Pods/WootricSDK/WootricSDK/WootricSDK/WTRApiClient.m:443
#9	0x105361190 in -[WTRApiClient createEndUser:] at /Users/tuur/Projects/mobile/frontend/ios/Pods/WootricSDK/WootricSDK/WootricSDK/WTRApiClient.m:250
#10	0x1053604e0 in __36-[WTRApiClient getEndUserWithEmail:]_block_invoke at /Users/tuur/Projects/mobile/frontend/ios/Pods/WootricSDK/WootricSDK/WootricSDK/WTRApiClient.m:141

As it turns out, we were passing numbers in setEndUserProperties:

RNWootric.setEndUserProperties({
  total_xp_amount: accountInfo.totalXp // number
  // ...
})

The Wootric SDK didn't like that - once I stringified all these numbers, the crashes stopped.

Note that:

  • this didn't happen with v1.5.5 - it handled numbers just fine. We left our own code untouched, just updated the SDK and that started the crashes.
  • the fact that setEndUserProperties only accepts strings is not documented anywhere.

Potential solutions:

  • Update setEndUserProperties to handle numbers without crashing
  • Prominently document the fact that setEndUserProperties only handles strings

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions