Re: UIDocument with NSFileWrapper
Re: UIDocument with NSFileWrapper
- Subject: Re: UIDocument with NSFileWrapper
- From: Quincey Morris <email@hidden>
- Date: Sat, 19 Mar 2016 10:48:11 -0700
- Feedback-id: 167118m:167118agrif8a:167118sI1DE-N1-v:SMTPCORP
On Mar 19, 2016, at 10:18 , email@hidden wrote:
>
> The downside I see for my app is that UIDocument writes out the data to a temporary location and then moves it to the new location so I think my app will constantly be writing out these image/PDF files that never change. Is there a better way to do this so that the image/PDF files only get written out when they’re first added (or changed if they do get changed).
a. It’s not obvious that the unchanged files *are* written to a temporary location and then moved. The trick is to keep the original directory wrapper that you got when opening the file, and to preserve the individual file wrappers for unchanged components. (You can, for example, just delete the file wrappers for things that *are* changed, when they’re changed, then add the missing wrappers at save time.) The save mechanism then knows what has and has not been changed, and can optimize the save appropriately.
b. Even if the files are copied, it’s not obvious that you need “a better way”. It may be fine to copy the files at every save.
I’d recommend you don’t try to solve this problem until it forces itself on you as an actual problem.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden