4

When my app comes back from a suspended state is behaving in a very strange way, so I would like to restart it from scratch in this situation.

But I don't want to restart it every time it enters the background and comes back to the foreground.

Is it possible to know if the app comes back from a suspended state or if it was just a background state?

Thanx in advance!

Abramodj
  • 5,709
  • 9
  • 49
  • 75
  • 3
    I received a down vote for this question... could you explain why? It seems to me that this is a proper and clear question. What's the problem with it? – Abramodj May 18 '12 at 12:09
  • between iOS4-iOS6, your application will be suspended in background unless you are using one of the background services: _audio_, _location_ or _voip_. you will find more info about this here: http://developer.apple.com/library/ios/documentation/iphone/conceptual/iphoneosprogrammingguide/ManagingYourApplicationsFlow/ManagingYourApplicationsFlow.html – holex Aug 19 '13 at 13:08
  • Maybe [this](https://stackoverflow.com/a/62465074/10974707) answer will help you. – מתניה אופן Mar 04 '21 at 13:28

1 Answers1

1

I believe that the short answer to this is No.

Apple's state documentation isn't explicit, but I would argue that the documentation implies that didEnterBackground is called in this situation, as it states that there are methods associated with each transition, but it isn't explicit, so I tested.

I wrote a short test program that uses region monitoring to force an app to transition from suspended to background. This isn't definitive, as it is also difficult to know if an app has transitioned from background to suspended, but after a couple of minutes, apps should be in suspended unless they're using background modes or tasks. Firing the region change ( through the debugger), I got didExtRegion callback, but no didEnterBackground.

mfaani
  • 33,269
  • 19
  • 164
  • 293
Gordon Dove
  • 2,537
  • 1
  • 22
  • 23