简体   繁体   English

将RLMFile存储到Realm Swift 3.0中的数组中

[英]Store RLMFile into array in Realm swift 3.0

I Want to store RLMFile into RLMArray . 我想将RLMFile存储到RLMArray Is there any way to perform this task. 有什么方法可以执行此任务。 If there is no way than Please tell me How can i store multiple images of property. 如果没有办法,请告诉我如何存储物业的多个图像。 This application based on storing properties and rooms available.

RLMFile isn't a type defined by Realm. RLMFile不是Realm定义的类型。 You can store binary files directly inside Realm as NSData , but this isn't recommended since you don't get any gains over simply saving the file to disk (and it also inflates the size of the Realm file). 您可以将二进制文件直接以NSData存储在Realm中,但是不建议这样做,因为仅将文件保存到磁盘并不会带来任何收益(并且还会扩大Realm文件的大小)。

It depends on what you want to do, but the easiest solution is to keep your images on disk, and then save their filenames/fileroutes to Realm. 这取决于您要执行的操作,但是最简单的解决方案是将映像保留在磁盘上,然后将其文件名/文件路由保存到Realm。 You would create a Realm object that saves the file name, and then each of these objects could be saved to the List property of a parent Realm object. 您将创建一个Realm对象来保存文件名,然后将每个对象保存到父Realm对象的List属性中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM