Re: Download images and modify bundle?
Re: Download images and modify bundle?
- Subject: Re: Download images and modify bundle?
- From: sebi <email@hidden>
- Date: Fri, 2 Jul 2010 14:19:00 +0200
Hello,
Sorry, it*s on an iPad, I forgot to mention. That's why I mentioned the documents directory, on a Mac I wouldn't want to save anything there automatically, thats right.
But to treat the bundle as non-writable is probably a good idea anyway. The problem is that I have thousands of files so I can't cache them all. Also there might be files with the same name and I have to use the newer one. So for every file access I have to look into both folders. Well, whatever, it's probably a bit tedious, but should be managable...
Thanks and regards,
Sebastian Mecklenburg
On 02.07.2010, at 13:50, Graham Cox wrote:
>
> On 02/07/2010, at 6:01 PM, sebi wrote:
>
>> When I download an image and want to keep it for further reference, I assume I have to store it in the documents directory and not in the app bundle, because otherwise I would invalidate the signature and the app wont run anymore. Is this correct?
>
> Mac or i<Device>?
>
> It's just not a good idea to ever treat your app bundle as a writable location. It wouldn't necessarily break code signing (???) but depending on what privileges your user is running with could fail anyway. Basically you don't want to be modifying your app as it runs.
>
> But a better location than Documents is ~/Library/Application Support/<YourApp>/<subdirectories as needed>
>
>> Background: I write a catalog app that is delivered with a bunch of images already that are in some folder hierarchy in the app bundle. As the user looks through the catalog, new images are loaded from the web. I would like to store these new images in the same directory as the original ones since otherwise I would have to manage two separate image locations. If I can't store the images in the app bundle together with the others I'm reduced to two options, if I see it correctly: Duplicate the original images to the documents directory (waste of memory) or manage two image folders (administrative overhead). Does anyone have a better idea? Maybe use of file-aliases?
>
> Managing two (or more) folders or sources shouldn't be a big headache if you design it with that in mind from the start. The user interface and the data model behind it can consolidate various locations on disk (or web-based) into one big virtual space if you want - I do that with several managed resource types in my app and it works nicely. From experience I'd say that copying bundle-based resources to another folder at first launch is a waste of time and effort (not so much memory though, as disk space is generally abundant) - I did it that way in earlier versions and regretted it.
>
> --Graham
>
_______________________________________________
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