我正在尝试创建一个协作式笔记应用程序,该笔记在iOS应用程序中保存为NSAttributedStrings,因为它们同时包含图像和文本。我可以将NSAttributedString保存到Cloud Firestore吗?如果可以,如何将NSAttributedString转换为Android设备和网站可以读取的格式?
- 积分
0 - 话题
0 - 评论
3201 - 注册排名
1834
我正在尝试创建一个协作式笔记应用程序,该笔记在iOS应用程序中保存为NSAttributedStrings,因为它们同时包含图像和文本。我可以将NSAttributedString保存到Cloud Firestore吗?如果可以,如何将NSAttributedString转换为Android设备和网站可以读取的格式?
As you can see from the documentation, Firestore strings can only store UTF-8 characters, so you will not be able to store it natively.
Android不能简单地“读取” NSAttributedString。据我所知,没有直接的Android等效产品。最接近的是Spannable,但是距离不是很近。
我建议您放弃将特定于操作系统的数据存储在Firestore中以供跨客户端平台使用的想法。如果将数据缩减为Firestore可以存储的原始类型,您将拥有更加轻松的时间。