Domanda

I am developing a simple photo editing app. I would like a journal feature for the user to view each of the photos they've edited. Some power user might have hundreds (or potentially thousands) of photos.

I am using Core Data to save photos. My concern is that hundreds of 640x640 photos might make the documents directory filesize rather large (side question: My assumption is my core data store is saved to my apps Documents directory. Is that true?).

Is it a problem to store so many photos locally within the app or am I being overly cautious? Is there a filesize limit on how much I can store?

È stato utile?

Soluzione

There is no limit for storing data in the documents directory (supposing you're using documents for data and core data for paths). There was a discussion on that in this question. Other than that, you'll be fine, working with data from documents directory is rather fast by default.

The thing is - will your users be happy with your app getting bigger and bigger? Can you perhaps give them the option to store the pictures on the server and let them set the cache size?

OR - you could go for storing it in the photo library if you get stuck with it...

Altri suggerimenti

The database location is specified in the method NSPersistentStoreCoordinator:addPersistentStoreWithType:. I think apple generates this to be in your documents directory. So you are correct in assuming its in the Documents dir.

On your main question I'm tending to think it is possible to do what you are saying (theres no limits on core data) but it might lead to not a nice experience for the user as it could lead to your app growing in an uncontrolled way. So syncing might slow up and your app might not be politely behaved for the user. So I don't think its a good idea as it stands if your power users will have 1000s of photos

Perhaps consider introducing a maximum quota of images that the app can deal with and loading/downloading images from an URL which you would specify as a path. What about using the SD card as an back up option. Hmm a lot of work I don't envy you. Mayby someone else has done something similar and they could give you a start.

I consulted the following Previous answers on stack overflow which deal with your issues raised mayby they help you to.

Core Data - Storing Images (iPhone)

Storing photos and videos in Core Data?

App Updates, NSURL, and Documents Directory

CoreData (for iphone) storing images

Storing large (e.g. image/movie) files in Core Data on the iPhone

Size limit of my ios app particularly Core Data

Hope this helps some what.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top