Skip to content

fix(ios): recognize NSLocationAlwaysAndWhenInUseUsageDescription - #1073

Merged
Lyokone merged 1 commit into
masterfrom
fix/ios-modern-always-permission-key
Jul 17, 2026
Merged

fix(ios): recognize NSLocationAlwaysAndWhenInUseUsageDescription#1073
Lyokone merged 1 commit into
masterfrom
fix/ios-modern-always-permission-key

Conversation

@Lyokone

@Lyokone Lyokone commented Jul 17, 2026

Copy link
Copy Markdown
Owner

Summary

Fixes #962requestPermission()'s internal requestPermission() (native, not the public Dart method) only checked Info.plist for the pre-iOS 11 NSLocationAlwaysUsageDescription key to decide whether it's allowed to call requestAlwaysAuthorization(). It never checked NSLocationAlwaysAndWhenInUseUsageDescription — the modern key Apple has required since iOS 11, and the one this plugin's own README recommends adding.

Concretely: an app that follows Apple's current guidance and declares only NSLocationAlwaysAndWhenInUseUsageDescription (without also adding the legacy NSLocationAlwaysUsageDescription) was treated by this check as having no always-usage description at all. If it also has no NSLocationWhenInUseUsageDescription, requestPermission() falls through to an NSLog warning and never prompts the user at all.

Fix: hasAlways now checks both keys.

Verification

  • flutter build ios --simulator --no-codesign and flutter build macos --debug in packages/location/example — both build clean (shared Darwin source).
  • Reverted incidental macos/Runner.xcodeproj churn from the build so the diff is feature-only.
  • Not runtime-reproduced (would need an Info.plist variant with only the modern key and a physical/simulator permission-prompt walkthrough); verified by tracing the exact Bundle.main.object(forInfoDictionaryKey:) check the issue points at, against Apple's documented Info.plist keys.

requestPermission() only checked the pre-iOS 11 NSLocationAlwaysUsageDescription
key to decide whether Always authorization could be requested, never the
current NSLocationAlwaysAndWhenInUseUsageDescription key -- the one this
plugin's own README recommends. An app declaring only the modern key was
treated as having no usage description at all, so requestPermission() fell
through to a warning log instead of prompting.
@Lyokone
Lyokone merged commit b8006ef into master Jul 17, 2026
6 checks passed
@Lyokone
Lyokone deleted the fix/ios-modern-always-permission-key branch July 17, 2026 18:01
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

Successfully merging this pull request may close these issues.

NSLocationAlwaysAndWhenInUseUsageDescription unimplemented?

1 participant