Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS App crashes if missing permissions for location updates #110

Open
louis123562 opened this issue Nov 7, 2024 · 4 comments
Open

iOS App crashes if missing permissions for location updates #110

louis123562 opened this issue Nov 7, 2024 · 4 comments
Assignees

Comments

@louis123562
Copy link

louis123562 commented Nov 7, 2024

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.

@mustafa0x
Copy link

mustafa0x commented Nov 13, 2024

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.

@louis123562
Copy link
Author

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.

@mustafa0x
Copy link

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.

@theproducer theproducer self-assigned this Nov 13, 2024
@mustafa0x
Copy link

mustafa0x commented Nov 14, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants