flutter-geolocator
flutter-geolocator copied to clipboard
[Bug]: `checkPermission()` does not reflect correct state after granting permissions via `requestPermission()` in Safari.
Please check the following before submitting a new issue.
- [X] I have searched the existing issues.
- [X] I have carefully read the documentation and verified I have added the required platform specific configuration.
Please select affected platform(s)
- [ ] Android
- [X] iOS
- [ ] Linux
- [X] macOS
- [ ] Web
- [ ] Windows
Steps to reproduce
- Grant permissions to Safari within the
Settingsapp- Mac OS: System Settings > Privacy & Security > Location Services (ON) > Safari (ON)
- (iOS): Settings > Privacy & Security > Location Services > Safari > While Using the App
- Execute your Flutter web in Safari
- Within your code, add some workflow that will trigger the following workflow:
...
var currentPermission = await Geolocator.checkPermission();
if (!isLocationPermissionGranted(currentPermission)) {
await Geolocator.requestPermission(); /// Grant while-in-use
}
currentPermission = await Geolocator.checkPermission();
assert(currentPermission, LocationPermission.whileInUse);
...
Tested in:
- Safari desktop 17.1.2
- geolocator plugin v10.1.0
Expected results
The assertion should pass in all supported platforms.
Actual results
This fails in Safari (desktop and mobile).
Code sample
Code sample
...
var currentPermission = await Geolocator.checkPermission();
if (!isLocationPermissionGranted(currentPermission)) {
await Geolocator.requestPermission(); /// Grant while-in-use
}
currentPermission = await Geolocator.checkPermission();
assert(currentPermission, LocationPermission.whileInUse);
...
Screenshots or video
No response
Version
10.1.0
Flutter Doctor output
Doctor output
[✓] Flutter (Channel stable, 3.13.9, on macOS 14.1.2 23B92 darwin-arm64, locale en-CA)
• Flutter version 3.13.9 on channel stable at /Users/jdbenito/development/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision d211f42860 (8 weeks ago), 2023-10-25 13:42:25 -0700
• Engine revision 0545f8705d
• Dart version 3.1.5
• DevTools version 2.25.0
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
• Android SDK at /Users/jdbenito/Library/Android/sdk
• Platform android-34, build-tools 34.0.0
• ANDROID_HOME = /Users/jdbenito/Library/Android/sdk
• Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.15+0-b2043.56-8887301)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 15.0)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 15A240d
• CocoaPods version 1.14.3
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2022.1)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.15+0-b2043.56-8887301)
[✓] VS Code (version 1.85.0)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.78.0
[✓] Connected device (4 available)
• sdk gphone64 arm64 (mobile) • emulator-5554 • android-arm64 • Android 13 (API 33) (emulator)
• JD Personal iPhone 13 Pro Max (mobile) • 00008110-001068C226A1801E • ios • iOS 17.1.2 21B101
• macOS (desktop) • macos • darwin-arm64 • macOS 14.1.2 23B92 darwin-arm64
• Chrome (web) • chrome • web-javascript • Google Chrome 120.0.6099.109
[✓] Network resources
• All expected network resources are available.