I am developing an application that allows the user to record videos and photos. Now I wonder what is the best way to store them?
The first idea is, of course, to save it in a custom photo library, just as if he had recorded a photo from the Camera application and used a link to files. Now the problem is that the user can receive and delete files from the Photos application, which my application may need. I do not think that I can prevent the user from deleting photos, but how can I deal with the inconsistency that my application will suffer from?
Another way is to take care of yourself. My application already uses Core Data, so I can convert media files from object NSValueTransformerto objectNSDataand save it as a BLOB in Core Data. Then there are a few more questions regarding performance. I know that SQLite-based baseline data can handle several GB databases very well, but loading large data objects will take some time. The obvious advantage is that the user is not going to make his application inconsistent, but is performance limitation acceptable? And most of all: if I use UIImagePickerControllerto capture photos and videos, it will still save it in the library. To save it to Core Data, I would have to take a picture, convert it to an object NSData, save it and delete it from the library again. This seems to be the wrong way for me. In addition, UIKit provides me with a function to get the objectNSDatafrom a photo using UIImageJPEGRepresentation(), but there seems to be no such function for video conversion.
In general, because of all the unanswered questions, I would like to use the first approach. But the problem of inconsistency puzzles me. What is the best practice for this?
source
share