Objective-C / Cocoa: Uploading Images, Working Memory, And Storage.

Posted by Finley Still on Stack Overflow See other posts from Stack Overflow or by Finley Still
Published on 2010-02-12T07:02:15Z Indexed on 2010/04/16 7:03 UTC
Read the original article Hit count: 267

Filed under:
|
|
|
|

Hello. I'm in the process of porting an application originally in java to cocoa, but I'm rewriting it to make it much better, since I prefer cocoa a lot anyway.

One of the problems I had in the application, was that when you uploaded images to it, I had the images created, (as say an NSImage object) and then I just had them sitting in memory, the more I uploaded the more memory they took up, and I ended up running out of memory.

My question is this: if I am going to have users upload images to this application in cocoa, how should I go about storing them? I don't just want to copy the file paths, because I want what is saved to contain the images, etc. Is there any way to upload an image and copy it into a different place only for my application? Then load that image with the new path name as needed?

Only I would like it all to be consolidated. I'm going to implement saving by archiving one "master" object into an NSData*- so I'd like the images to be saved with that.

Is there a temporary location maybe where I could write the images to disk for my application, and then when I saved, they would all be archived into a single file? Also, how do I do this? Thanks.

© Stack Overflow or respective owner

Related posts about cocoa

Related posts about objective-c