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.

Name.app
Bundle Container

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.

Documents
Data Container

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.

Inbox
Documents

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.

Library
Data Container

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.

Caches
Library

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.

Preferences
Library

As the name indicates, this folder contains the preferences that your app wants to remember between launches.

Application Support
Library

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.

Temp
Data Container

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.

Check Where You Should Put Your iOS App Files.

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.

Have you got a cool idea about iPhone App Development? Contact us Now to get a free consultation on your idea. Alphanso Tech is rated as one of the best iPhone App Development Company in India.

Post by Milan Sanathara

I am iOS Application Developer with an aspiration of learning new technology and creating a bright future in Information Technology.

One Response to How iOS Backup your App Data Automatically?

  1. Pingback: Where You Should Put Your iOS App’s Files?

Leave a Reply

Your email address will not be published. Required fields are marked *