Provide example for why it is not advisable to store images in CoreData?

前端 未结 3 1398
温柔的废话
温柔的废话 2021-01-07 14:48

this question has been asked many times, I have read many users telling that it is not advisable to store images in a DB, in particular within CoreData. By they all seems to

3条回答
  •  一整个雨季
    2021-01-07 15:41

    There's nothing special about what Core Data normally does here. It's just using an SQLite database. You can put large blobs of data into it, but it just doesn't scale all that well. You can read more about it here: Internal Versus External BLOBs in SQLite.

    That said, Core Data has support for external blobs which in Core Data terminology is called stored in external record (iOS 5.0 and later). Again, there's nothing magic about it, it's just storing the large pieces of data in the file system separately from the SQLite db itself. The benefit is that Core Data updates all this for you.

    When you're in Xcode, there'll be a checkbox called Allows External Storage that you can check for Binary Data properties.

提交回复
热议问题