Is UIDocument a suitable strategy for large documents with metadata?

693 Views Asked by At

I'm looking into using UIDocument en NSFileWrapper to store 'projects' that contain quite a few large video files and some small text files. There are a few problems that I run into, and I'm starting to wonder if UIDocument is still the right strategy.

Performance

As far as I can tell, NSFileWrapper loads everything in memory. This can be a problem when working with large video files. I think it's possible to work around this by using custom save and load methods that forego the standard NSFileWrapper.

Metadata

I want to display a list of all the documents along with some metadata. This can for example include a preview image, number of recorded scenes, length of videos etc. The only way to fetch this data now is to open each document and retrieve it. Probably quite slow, especially with large documents.

Solutions?

I see two solutions now: ditch UIDocument altogether and go for a custom architecture, or use some kind of centralized metadata file. Drawbacks of the latter is that I have to manage metadata in two separate places and that I need to keep them in sync manually.

Is UIDocument still the way to go here, and if so: What could be a way to solve these problems?

1

There are 1 best solutions below

0
On

Based on the comments the asker found a way to move forward as such:

drop UIDocument in favor of a Core Data solution. I now save all my data using Core Data and manually manage the large files on the filesystem. It works pretty well for me, and I'm glad I made the switch. The only thing I had to give up was easy iCloud syncing. But with files as large as these, that wasn't really feasible anyway. It seems you can create your own file wrapper class to work around some performance problems with large files.