How iOS Backup your App Data Automatically?
For security purposes, an iOS app has limited the number of places where it can write its data. When an app is installed on a device (either from iTunes or the App Store), the system creates a number of containers for the app.
Check out our blog on File Structure of iOS. In this Blog, we will discuss how iOS backup app data automatically.
This is the app’s bundle. The contents of your main bundle all go in here.
For instance, all your app icons, your app binary, your different branding images, fonts, sounds, etc., are placed in this folder automatically when iOS installs your app on a device.
You cannot write to this directory. You can, however, gain read-only access to any resources stored in the apps bundle.
The name is the product name that you set for your app. So if your app is called MyApp, the .app folder will be called MyApp.app.
Use this directory to store user-generated content. The contents of this directory can be made available to the user through file sharing; therefore, his directory should only contain files that you may wish to expose to the user.This folder is the destination for all user-created content.
Content that your app has populated, downloaded, or created should not be stored in this folder.
Use this directory to access files that your app was asked to open by outside entities. Specifically, the Mail program places email attachments associated with your app in this directory. Document interaction controllers may also place files in it.
Your app can read and delete files in this directory but cannot create new files or write to existing files.
This is the top-level directory for any files that are not user data files. You typically put files in one of the several standard subdirectories. iOS apps commonly use the Application Support and Caches subdirectories; however, you can create custom subdirectories.Use the Library subdirectories for any files you don’t want to be exposed to the user. Your app should not use these directories for user data files.
You use this directory to store cached files, user preferences, and so on. Usually, this folder on its own does not contain files. It contains other folders that contain files.
The folder where you store data that your app can later recreate if need be. Do not allow your app to rely on the contents of this folder too much; be prepared to re-create this content.For instance, if your app relies on files and folders that are to be created on disk, this folder is not the best place to store this data. You are better off storing such files and folders in the temp folder.
iOS might remove the contents of this folder if the device is running out of disk space while your app is not running! and can be deleted while your app is suspended.
As the name indicates, this folder contains the preferences that your app wants to remember between launches.
The data that your app creates, not including the data created by the user, must be stored in this folder. It is good to know that.
This folder might not be created for you automatically, and you’ll have to create it yourself if it doesn’t exist.
Use this directory to write temporary files that do not need to persist between launches of your app. Your app should remove files from this directory when they are no longer needed; however, the system may purge this directory when your app is not running.These are temporary files that your app creates, downloads, and so on. For instance, you can download a few photos from the Internet and store them in this folder in order to increase the performance of your application, so that you won’t have to download the files every time the user opens your app. This folder serves exactly this purpose.
Make sure that you are not storing any user created documents or files in this folder.
I hope you will find this post very useful regarding iOS backup. Let me know any question if you have in comment regarding iOS. I will reply to you ASAP.