flutter-geolocator
flutter-geolocator copied to clipboard
[Question]: iOS background doesn't work (kCLErrorDomain error 1)
Please check the following before submitting a new issue.
- [X] I have searched the existing issues.
- [X] I have carefully read the documentation.
Please select for which platform(s) you need help
- [ ] Android
- [X] iOS
- [ ] Linux
- [ ] macOS
- [ ] Web
- [ ] Windows
Your question
final locationSettings = AppleSettings( activityType: ActivityType.fitness, showBackgroundLocationIndicator: true, allowBackgroundLocationUpdates: true, );
final sub =
LocationUtils.getPositionStream(locationSettings: locationSettings).listen((event) {}, onError: (error) {
print('=======$error');
});
background is enable
info NSLocationAlwaysAndWhenInUseUsageDescription NSLocationAlwaysUsageDescription NSLocationWhenInUseUsageDescription
Flutter 3.19.5 Tools • Dart 3.3.3 • DevTools 2.31.1
Version
12
Dear @jupeng123,
What type of permission have you requested? Could it be related to this issue? And can you check if this works in the example app?
Kind regards,
Dear @jupeng123,
What type of permission have you requested? Could it be related to this issue? And can you check if this works in the example app?
Kind regards,
static Future
LocationPermission permission;
permission = await Geolocator.checkPermission();
if (permission == LocationPermission.denied) {
permission = await Geolocator.requestPermission();
if (permission == LocationPermission.denied) {
return false;
}
}
if (permission == LocationPermission.deniedForever) {
return false;
}
return true;
}
Dear @jupeng123,
I asked another question. Are you able to reproduce it with the example app?
Kind regards,
Dear @jupeng123,
I asked another question. Are you able to reproduce it with the example app?
Kind regards,
Location permission has been granted
kCLErrorDomain Code 1 occurs when the user has denied your app access to location services. Please check if you have the correct permissions for background locations on iOS. Also try if it is happening with the example app. Also are you testing this on a real iOS device? Because your screenshot does not look like default iOS.
Kind regards,
kCLErrorDomain Code 1 occurs when the user has denied your app access to location services. Please check if you have the correct permissions for background locations on iOS. Also try if it is happening with the example app. Also are you testing this on a real iOS device? Because your screenshot does not look like default iOS.
Kind regards,
Location permissions are all enabled
kCLErrorDomain Code 1 occurs when the user has denied your app access to location services. Please check if you have the correct permissions for background locations on iOS. Also try if it is happening with the example app. Also are you testing this on a real iOS device? Because your screenshot does not look like default iOS.
The device is an iPhone, and location services and permissions are enabled
Dear @jupeng123,
Did you try to run this in the example app? Can you check if the location services are enabled in : Settings > Privacy > Location Services > Your App.
Kind regards,
Without additional information, we are unfortunately not able to resolve this issue. Therefore, we reluctantly closed this issue for now. If you run into this issue later, feel free to file a new issue with a reference to this issue. Add a description of detailed steps to reproduce, expected and current behaviour, logs and the output of 'flutter doctor -v'. Thanks for your contribution.