Which is permanent storage directory in iOS? - ios

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

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.)

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

Related

Offload App remove what in iOS 11

I just installed iOS 11 beta and I noticed that Offload App, By offloading app what will be remove Shared Directory or User Default or remove both or other than this ?
Looking for suggestions.
Thanks
Offloading lets you ”offload” the bundle (.ipa) for your app to save disk space. It will delete the ipa file (which contains your libraries and resources) and store only Documents and Data that includes shared data, UserDefaults etc..
Once we offload the app, what remains is the app icon of it with a small download pip on it to indicate that it has been offloaded .
Just by simple tapping on it, the app will get downloaded from the store and the saved Documents and Data will be integrated to the downloaded app, instead of an empty directory as it normally would with a fresh install.
This is a really great feature by Apple especially for devices with just 16GB storage. As you can see offloading the Prisma app saves me 44MB which is great. And even more, iOS can automatically offloads unused apps for us.
There is no official document(technical) available for offloading apps till the date but as the description(in setting app) says that your documents and data will be saved then I think it will save user defaults , document directories and core data - I mean all kind of data that can be stored!
It will save Shared Directory & User Defaults. Everything else will be deleted.

IOS - In-app purchase downloadable media storage guidelines

I have an app which has in app purchase downloadable videos. The first time I submitted to the app store it was rejected because I was writing it to <Application_Home>/Documents directory. The rejected reason stated that
In particular, we found that on launch and/or content download, your
app stores 20MB.
I read the guideline and it told me that
Data that can be downloaded again or regenerated should be stored in
the <Application_Home>/Library/Caches directory. Examples of files you
should put in the Caches directory include database cache files and
downloadable content, such as that used by magazine, newspaper, and
map applications.
I checked the simulator's cache directory and found that there is a default folder within the Caches folder with the name of the Bundle Id of the app. So I changed it to the following path
<Application_Home>/Library/Caches/<Bundle ID>/
Ran this in the sim and seems fine. However, when I uploaded it, it was rejected. The problem seems to come from writing the data.
Question: Is there something wrong with this directory? Should I just store it in the Caches root folder?
Thanks.

iOS Documents Directory size limit

I am creating FTP download app that downloads into Documents Directory, and I have simple questions. Does the Documents Directory have size limit and does the download files stay there permanently until the app is removed?
I don't know much about this, I had seen a comment in discussions.apple.com like:
There is a limit of 2 GB.
https://discussions.apple.com/message/7599983?messageID=7599983#7599983?messageID=7599983
Files in the document directory stay there permanently until the app is removed.
============EDIT=========
the fact is: 2Gb is the app size limit, and the app's directory can more than 2Gb;
I found it from apple doc is here , search keyword "2G"
I don't know if apple did some change, I use an app named PPTV, it can store videos from server, and more than 2Gb; what happens?
You should use Cache Directory if you want to cache anything without user's action or your app will get rejected if you dont follow the instructions:
http://developer.apple.com/library/ios/#documentation/iphone/conceptual/iphoneosprogrammingguide/PerformanceTuning/PerformanceTuning.html

Where to Store purchased very huge files >200MB on iOS?

Where i have to store downloaded huge files on iOS?
the file is more then 200MB.
Is < Application_Home >/Library/Caches the right directory for it?
The file is downloaded after in app purchase and should remain in the App.
After iCloud is implemented in Apple, The Document directory data is somehow related with iCloud Storage. Hence Apple is now rejecting the applications using heavy data storage in document directory.
You need to store the data at some other location. Store the PDF & Other Artwork file At some other location.
This link May Help You.
https://developer.apple.com/icloud/documentation/data-storage/
I Hope this helps.

Which folder should I use to save user's photo taken by app

I'm developing photo app but my app has rejected twice because of iOS Data Storage Guideline.
I don't know an exact folder which saving user's contents (In this case, user's photo taken by my app).
I guess '/Documents' could be answer, but I have no confidence.
You can save the images inside the apps document folder or can save the paths to images .
You can create you own sub directory of document i.e Documents/Photos. You can check they are saving to the correct place by enabling iTunes to access the documents folder and checking that they are being written to the correct place.

Resources