capacitor-background-runner icon indicating copy to clipboard operation
capacitor-background-runner copied to clipboard

iOS App crashes if missing permissions for location updates

Open louis123562 opened this issue 1 year ago • 6 comments

Our app was rejected by Apple because we had the background mode 'location updates' enabled, but we dont implemented a feature that would take use of it. The background mode with 'location updates' is required by the documentation of this plugin.

image

Because we dont use this feature in the background runner at all, we disabled the background mode. This leads to an crashing background runner.

image

We were able to modify the sourcecode of the background runner not using location at all. Now the app runs without crashes and without the backgroundmode 'location updates'.

image

This is a similar request to #86 which focuses Android. We would like to see more updates for the background runner; handling especially permissions.

louis123562 avatar Nov 07 '24 15:11 louis123562

Thanks for sharing this @louis123562! Just to confirm, flipping the boolean was the only change needed, right? Apple is saying I need to fill NSLocationAlwaysAndWhenInUseUsageDescription but I also don't use location.

mustafa0x avatar Nov 13 '24 08:11 mustafa0x

Thanks for sharing this @louis123562! Just to confirm, flipping the boolean solved was the only change needed, right? Apple is saying I need to fill NSLocationAlwaysAndWhenInUseUsageDescription but I also don't use location.

Do i get you right; your app does not access/use location at all? My app does use location, but triggered by the user (not the bg runner). For my case, it was enough to flip the boolean from true to false.

You can fill NSLocationAlwaysAndWhenInUseUsageDescription with an explanation in Info.plist; the user won't see it until you actually ask for permission to locate or if you actually try to access the location.

louis123562 avatar Nov 13 '24 09:11 louis123562

Correct, the app doesn't use location at all.

I set allowsBackgroundLocationUpdates to false, but when submitting the app, I receive an email from App Store Connect with the following.

Although delivery was successful, you may want to correct the following issues in your next delivery. Once you've corrected the issues, upload a new binary to App Store Connect.

ITMS-90683: Missing purpose string in Info.plist - Your app’s code references one or more APIs that access sensitive user data, or the app has one or more entitlements that permit such access. The Info.plist file for the “App.app” bundle should contain a NSLocationAlwaysAndWhenInUseUsageDescription key with a user-facing purpose string explaining clearly and completely why your app needs the data.

I can fill NSLocationAlwaysAndWhenInUseUsageDescription as you suggested, but would prefer to avoid location altogether.

mustafa0x avatar Nov 13 '24 12:11 mustafa0x

I removed code that references location in Context+CapacitorAPI.swift and BackgroundRunnerPlugin.swift. That seemed to do it. Apple no longer tells me I need to fill NSLocationAlwaysAndWhenInUseUsageDescription.

mustafa0x avatar Nov 14 '24 19:11 mustafa0x

Same here, I have to change self.locationManager.allowsBackgroundLocationUpdates = false for App Store validation (I not use geolocalisation)

cschoenecker avatar Jun 06 '25 08:06 cschoenecker

Hi, we have exactly the same issue, any long term solution? Many thanks 👍

Diegoescalonaro avatar Jun 09 '25 10:06 Diegoescalonaro