Unexpected restart of app into background

I activate the conditions as follows

Unexpected operation found. Details are below

Conditions and configurations used in the testing

  • "Background Modes" Capability with "Location updates" checked on
  • added the info.plist keys: NSLocationAlwaysAndWhenInUseUsageDescription, NSLocationWhenInUseUsageDescription with description
  • invoking startMonitoringSignificantLocationChanges using core location API
  • invoking didUpdateLocations using core location API
  • Using Background fetch (15 minutes)

I swipe the app to switch from foreground to background mode, and stop the app without deleting it in the switcher.

A few hours after the app was stopped, didfinishlaunch, didenterBackground, background fetch, and didUpdateLocation code did not run, but the app started running again in the background from the point it was stopped.

The wake-up time is random, and the app will freeze again within a few seconds of running again.(I took logs in all delegate functions related to the app life cycle in the AppDelegate file, but nothing was executed when the app was relaunched.) Is the above behavior normal?

If it's normal, who wakes up the app? How do I prevent my app from restarting unexpectedly?

Replies

stop the app without deleting it in the switcher.

What does that mean? Did you just press the Home button (or perform the corresponding gesture on devices without a Home button)? Or something else?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

  • I just press the Home button without any gesture)

Add a Comment

I just press the Home button without any gesture)