Unexpected iOS App foregrounding

I am seeing some unexpected behavior, in particular, is seems that iOS is periodically foregrounding my test app with no user intervention. I am curious why this is.

I wrote a simple test app to see how long the app would run to collect location while in the background with only "While in Use" location permission. The app will start location updates when foregrounded and continue in the background. While backgrounded, I see the blue arrow in the dynamic island as expected. What is unexpected is that every few days, I see the UI of the app displayed in the foreground, without having foregrounded it myself (and no, I did not tap the blue arrow).

This is using the legacy CoreLocation apis on iOS 17.5.1.

My question is how/why does this happen?

This is not something that should, or could happen. You may want to observe the situations that this occurs carefully and make sure it is not something that is accidentally happening during the normal use of the phone.

What are the exact circumstances you see this happen? Is the phone untouched and locked? Is it in your pocket? Are you using another app at the time? Or is it sitting idle, unlocked at the Home Screen?

All these are quite impossible scenarios, but if you have the specifics we would like to hear them.

Also, make sure you are not confusing the app being foregrounded with the occasional popup of the location permission dialog, which will happen as a reminder to the users that your app is accessing their location, and that is not something that can be disabled.


Argun Tekant /  DTS Engineer / Core Technologies

I think I have usually seen it when unlocking the phone, but I can continue to monitor, and pay closer attention. When I have seen it, I have triggered a sysdiagnose log, but I have no idea what to look for. Would that be useful to look at?

Other than (1) tapping the blue arrow (2) selecting the app from the "carousel" of backgrounded apps. (3) tapping the app icon are there any other ways for the user to foreground the app?

Also, make sure you are not confusing the app being foregrounded with the occasional popup of the location permission dialog, which will happen as a reminder to the users that your app is accessing their location, and that is not something that can be disabled.

I don't see the location permission popup at all, which makes sense, since the allowed permission is "While in Use". I would only expect the popup for "Always" permission, correct?

If you have a sysdiagnose, it would help to create a Feedback Report and attach it, along with explaining exactly when and how it happened once you have observed it closer.

Actually it would help to mark the time this happened, and then create a new sysdiagnose at that time so we know what to look for.

If you share the Feedback ID here, we can make sure the appropriate people will see it.

I just submitted a feedback report: https://feedbackassistant.apple.com/feedback/14440945

BTW, no apparent action on the feedback request.

@cesarfromnull We have been trying to make some sense of your Feedback report and sysdiagnose, and we see some discrepancies between your description of the incident and what we see in the logs.

We need to discuss this further and clarify some information.

Please open a support request at https://developer.apple.com/contact/request/code-level-support/ and reference this forum thread in the "Did someone from Apple ask you to submit ..." section

We will continue this discussion there.


Argun Tekant /  DTS Engineer / Core Technologies

Unexpected iOS App foregrounding
 
 
Q