> On Mar 19, 2016, at 1:48 PM, Quincey Morris 
> <quinceymor...@rivergatesoftware.com> wrote:
> 
> On Mar 19, 2016, at 10:18 , davel...@mac.com 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.
> 

Ok, I'll give it a try and see if it slows down too much or seems to be 
constantly overwriting these files before worrying any more about it. I just 
wondered if there was a "better way" to do it so I figured I'd ask before I 
delved to far into it. I'm not certain I fully understand what to do with 
NSFileWrapper in this case but I'll give it a try. My thought is to have a 
dictionary mapping each image filename to a NSFileWrapper. I may also need a 
plist of all image filenames so I can read that first and then read each of 
those image and store them in the dictionary of NSFileWrapper objects. I need 
to re-read the documentation again although it seemed the documentation for 
NSFileWrapper was pretty limited and didn't apply to this case where there's 
not a fixed number of files each with specific names.

If anyone has links to better documentation for my other question about 
exporting the document type using Xcode 7, I'm still in need of help there. 

Thanks,
Dave


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to