0

I am developing a navigation like app. It works fine for the location manager to get the device's current location both in foreground and background.

In foreground it works fine for however long. However, when the app goes to background mode, initially the location manager works well. But after around 2 minutes, the app exited and the console shows the error message saying: "Message from debugger: Terminated due to signal 9."

I searched the error message, but still could not find the solution to it. Quitting app causes error "Message from debugger: Terminated due to signal 9"

I noticed the CPU usage is very high, around 105% in background mode. This could be the reason that the OS send the KILL signal. But even if I decrease the location manager's accuracy (but for navigation purpose I still need the highest accuracy ultimately), the problem is still there.

So I am really wondering how those fitness apps managed to track user's locations in the background for however long without being killed by the OS.

Rui Luo
  • 1
  • 1
  • 3
  • For people who have similar problems. I solved this by using the instruments, and I found one simple animation of one viewController in the navigation stack which has not been terminated. That one simple animation in the VC stack in the background, somehow, caused the cpu usage to 100%. – Rui Luo Jul 07 '17 at 22:53
  • Did you get any solution? I am having the same issue in iOS 11.2.6 version. – Shahabuddin Vansiwala Feb 23 '18 at 10:19

1 Answers1

0

I think your problem is due to a complex graphical user interface which was refreshed every second even if the app was in background

To prevent the app to be killed while in background, stop doing high CPU using things, like rendering images, when the app is in background mode.

  • Thanks! Yeah, I just found out that apart from getting new locations, the app does lots of other things. – Rui Luo Jul 07 '17 at 20:46