Is UIDocument a suitable strategy for large documents with metadata?
Asked Answered
C

1

9

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?

Cheater answered 5/6, 2014 at 19:0 Comment(4)
Have you came to any conclusions ? would be great hearing as I also see poor performance from UIDocument...Mandragora
These two questions (stackoverflow.com/questions/23265422, stackoverflow.com/questions/13621502), along with my own research have lead me to 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.Cheater
@Cheater Do you know if the situation has improved in the year 2020?Fundamental
@zrfrank: I'm sorry but I haven't used UIDocument (or written a MacOS app for that matter) in years, so I don't know what the current situation is.Cheater
O
0

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.

Offstage answered 3/8, 2021 at 20:6 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.