Driftt / drift-sdk-ios

Drift for iOS, for integrating Drift into your iOS application.
http://www.drift.com
MIT License
12 stars 17 forks source link

'UserDTO' Decoding error: Expected to decode Int64 but found a string/data instead. #107

Closed RBasiev closed 4 years ago

RBasiev commented 4 years ago

Hi! I recently updated Drift pod to 2.4.0 version, and got the following error with UserDTO decoding (caught by breakpoint).

Function: DriftManager.75 class func registerUser Request: URL: https://event.api.drift.com/identify Response: {\"id\":\"404cba19856ce46a9f7b1f5ef4409215\",\"userId\":\"1000059\",\"anonymousId\":null,\"companyId\":null,\"internal\":false,\"attributes\":{\"email\":\"rus.basiev@gmail.com\"},\"context\":{},\"createdAt\":1585788857338,\"orgId\":1167954,\"signedIdentity\":null,\"isDebug\":false}"

In model I found that user's identifier is: var userId: Int64? It makes url request, and tries to decode UserDTO from response. But as you see, there is a string 'id' in response JSON.

The result of decoding UserDTO is not used, so the next function (auth) works fine. But maybe you can fix user decoding to prevent Swift Error Breakpoint activation

eoinoconnell commented 4 years ago

Thanks for that, have that resolved and should be live on Cocoapods in the next 30 mins

Appreciate the help!