Sarthak mirajkar
Sarthak mirajkar

Reputation: 191

What is the difference between background state , InActive State & Non-running state of iOS App?

Can you please explain me

  1. What is the difference between background state , InActive State & Not-running state of iOS App?
  2. What is the difference between Main Bundle and Documents Directory? (Suppose I download a file/resource(e.g data.plist) from app ,so where can i find it? In Main Bundle or Documents directory or somewhere else?)

Thanks

Upvotes: 12

Views: 17411

Answers (2)

Bhumit Mehta
Bhumit Mehta

Reputation: 16318

1. What is the difference between background state , InActive State & Not-running state of iOS App?

InActive State

The app is running in the foreground but is currently not receiving events. (It may be executing other code though.) An app usually stays in this state only briefly as it transitions to a different state.

Background state

The app is in the background and executing code. Most apps enter this state briefly on their way to being suspended. However, an app that requests extra execution time may remain in this state for a period of time. In addition, an app being launched directly into the background enters this state instead of the inactive state.

Not-running state

The app has not been launched or was running but was terminated by the system.

Please refer to this Apple doc and following image for understanding more about App states

App States

2. What is the difference between Main Bundle and Documents Directory? (Suppose i download a file/resource(E.g. data.plist) from app ,so where can i find it? In Main Bundle or Documents directory or somewhere else?)

Main bundle is some thing which contains files which you have added along with the iPA . It is read only you can not add or remove files to main bundle programatically.

Document directory is empty when user installs the app and you can save and remove as many files as you want in it (Depending upon space available in the device). So the file which you download you can save it in document directory.

Suggestion

I would recommend you to read apple docs and other tutorials like This, it would really help you understand concepts better.

Upvotes: 10

saurabh goyal
saurabh goyal

Reputation: 438

  1. Please refer this link for detailed info about iOS application states .

It says :

Non-running - The app is not running.

Inactive - The app is running in the foreground, but not receiving events. An iOS app can be placed into an inactive state, for example, when a call or SMS message is received.

Active - The app is running in the foreground, and receiving events.

Background - The app is running in the background, and executing code.

Suspended - The app is in the background, but no code is being executed.

  1. At the time of downloading at dynamic time in app , we need to give path for the detination , that will be of Documents Directory .

Main Bundle is the space where you can add the files initally and ship with the ipa.

Detailed difference you can find here

Hope this solves your Query.

Upvotes: 7

Related Questions