My App is running in the background and I don't know why

Hello,

I find out my App is running a lot in the background.

For example, over the last 24 hours.

My app is responsible for 18% of the battery usage. Also it shows the app was 1 minute on screen, then 11H41 min background.


The app uses CloudKit so in the capabilities I added "Remote Notifications".

In the sceneDidEnterBackground, I added a line to save the context.

Code Block
(UIApplication.shared.delegate as? AppDelegate)?.saveContext()


I'm also using the user location but I blocked the background refresh.

Code Block
 self.locationManager.allowsBackgroundLocationUpdates = false


Finally, I'm using googleAdMob pod to display a banner.

Any idea why the app is consuming so much?
Also, Is there an instrument I could use to analyse this in development?

Thanks,
Nicolas




Hi Nicolas, were you able to figure out why this is happening?
My App is running in the background and I don't know why
 
 
Q