HarmonyOS 首选项超长string存储失败?

首选项超长string存储失败,错误日志:

Convert2NativeValue: string  must be less than the limit length.
 SetAction: throw error: code = 401 , message = Parameter error. The type of value mast be ValueType.

我看首选项描述中有提到,如果存入值是string,长度不能超过 16*1024*1024字节

但我存入的string字符串只有 19942 呀

阅读 632
1 个回答

value值过长,首选项Value的最大长度限制为8192个字节。可考虑使用kv数据库或者rdb进行储存

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进