0

I'm developing an app that I want the user to be able to take a screenshot with a button (this works, but it's stored to camera roll). I have a need to keep history of these screenshots along with site name, etc.

I've been reading that it's not recommended to save binary data in a sqlite db, so I've stumbled across core data. I'm still learning, but one question that comes to mind is this. Some recommend to save the filename to coredata and then save the image to document directory. I want to read the data back into a table view controller and have the image part of the cell. Will I need to resize the image to the size I want when reading in, or will it automatically size down to what it needs?

Also, when saving to document directory, are those files accessible from the camera roll? I don't want them to be and I'd like to give the user the ability to be able to delete them with the tableviewcontroller.

Please let me know if I need to expand on anything. I'm learning Swift, so I'm sure I missed something.

Nutrion
  • 53
  • 1
  • 9
  • Is your app a document-based application? That is, are you using UIDocument? – Jerry Krinock Apr 26 '19 at 20:01
  • No it's not. It's just an app that visits a site, takes a screenshot of that site, and I want to save the screenshot along with other metadata about the site. I had first thought I'd just save the image to a sqlite database, but I've been reading that's a bad practice. – Nutrion Apr 26 '19 at 20:24

1 Answers1

0

You should not save it to the Documents directory.

You should instead Allow External Storage of the attribute. Core Data will take care of storing it for you. This is explained in the answer by jansenmaarten to this question.

Jerry Krinock
  • 4,860
  • 33
  • 39