customerio / customerio-flutter

Flutter plugin for Customer.io
https://www.customer.io/docs/sdk/flutter/getting-started/
MIT License
12 stars 10 forks source link

Error in iOS build: Tried to convert ["attribute_key": AnyHashable(attribute_value)] but the data tyep is not Encaodable #112

Closed VeeTsien closed 6 months ago

VeeTsien commented 6 months ago

Hi, I just went through config with the customer io flutter SDK and finally, the iOS app builds. But I'm getting the error message in the console mentioned in the title Error in iOS build: Tried to convert ["attribute_key": AnyHashable(attribute_value)] but the data tyep is not Encaodable when setting attributes on people using CustomerIO.identify and CustomerIO.setProfileAttributes. My iOS simulator is also not showing up as a device in the customer io people dashboard. I tried using jsonEncode and jsonDecode but it didn't work. Any suggestions on how to solve this?

VeeTsien commented 6 months ago

Okay, I just found the solution after 5min of posting this issue... first, seems like all the attribute values need to be strings, also I have a few nullables that needs to be set to and empty string if null.(which would be handy to know in the doc, or maybe I just missed it) But still, my ios simulator isn't showing up as a device. Is there a lag for that to show up? Does it have to be a physical device?

mrehan27 commented 6 months ago

Thank you for reaching out to us. Below are the answers to your questions:

Attribute values must be types that can be encoded, therefore objects and custom types will not work. Standard types like doubles and strings are supported, with strings being the recommended option. We've noted the need for clearer error messages and documentation on this and will try to improve them for better experience.

For nullable values, they can be excluded from attributes. If this doesn't work for you, please do share and let us know about your use case so we can help you better.

For device visibility, device token generated by FCM is required for device to be recognized. Although real devices consistently produce a device token, the behavior on simulators might not be as consistent. You can capture logs to check if your simulator is generating a device token. However, testing on an actual device is recommended for the most accurate experience. Events and devices usually start appearing on Dashboard within about 30 seconds.

In case you have further questions or need more clarification, please feel free to reach out.

VeeTsien commented 6 months ago

Hi @mrehan27 thanks for your reply. I got everything working now so will close this one.