0

I need to store permanently (as far as app is not uninstalled from the device), the photos that are taken from camera roll and photo library into my app's bundle. Perviously i was storing those file in tmp folder, i read that the contents of tmp folder will be purged by iOS if it finds less memory for other app to run.. so my images were not getting displayed in my app after 3 or 4 days as IOS would have purged the content of tmp folder. SO where do i need to Store these files? In Documents folder? is documents folder is permanent ?people say that you should not store huge amount of files in documents folder.. There is no limit for the photos that can be taken from my app. user may take 100 photos, 200photos, 500photos, or more than that.. its ok if user uninstall the application.. i will download all those photos in background once he login again. so what would you suggest for this problem? any kind of help is highly appreciated.

thanks

RockandRoll
  • 409
  • 5
  • 23
  • You know the answer very well. – Anoop Vaidya Mar 27 '14 at 05:10
  • If you can just download the photos in the background, why don't you do so when they are purged by IOS after 3-4 days? Also, you might consider storing thumbnails in the Documents folder, and the actual photos in the temp folder. – Slartibartfast Mar 27 '14 at 05:12
  • Hey Slartibartfast, Your idea seems to be pretty good, but i don't know exactly when the memory will be purged? memory may be purged any time right?and what if the app is not running in background? and i think downloading files when contents of tmp folder is empty is not feasible as downloading files may add up more net charges to the user.. – RockandRoll Mar 27 '14 at 05:47

2 Answers2

1

You put the files in the Documents folder, or if you can download them again from Internet, in the cache folder. If in Documents folder, you must mark the files with the attribute that prevents them from getting backed up to iCloud, or your app will be rejected. Do that using this documentation:

https://developer.apple.com/library/ios/qa/qa1719/_index.html

These rules are enforced pretty vigorously by Apple and spelled out in:

https://developer.apple.com/icloud/documentation/data-storage/

(Requires iOS app developer login to view, I believe.)

RobP
  • 9,144
  • 3
  • 20
  • 33
0

What you are looking for here is SQLite. Using SQLite you can store your data and Images. For storing the Images you can refer this link

Community
  • 1
  • 1
Spidy
  • 1,137
  • 3
  • 28
  • 48
  • See also my comment under Mr Haze's response. Why would the OP want to use a database rather than the file system? Databases are for data you want to organize and query, so unless the photos had lots of metadata to be searched SQLite and Core Data are not the right fit. – RobP Mar 27 '14 at 05:18
  • Using `SQLite` you can also save images. This is called `BLOB`. If you can refer the link which leads to another question in SOF then you will get to know what I am trying to say. – Spidy Mar 27 '14 at 05:23
  • well sure you *can* put images in a database, and I've done so, but what is the advantage of doing so? There are many convenience methods for dealing with images in the file system that you'd lose use of. – RobP Mar 27 '14 at 05:24