You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have carefully read the documentation and verified I have added the required platform specific configuration.
Please select affected platform(s)
Android
iOS
Linux
macOS
Web
Windows
Steps to reproduce
Implement location tracking using the Geolocator plugin in a Flutter app.
Create functions _getCurrentLocationForIOS and _enableLocationUpdatesForIOS using AppleSettings for iOS.
Call these functions on an iOS device to get the current location and enable continuous location updates.
Observe the type conflict and other errors during runtime.
Expected results
Example: The application should retrieve the current location and enable continuous location updates on iOS devices without any type conflicts or runtime errors.
Actual results
[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: The operation couldn’t be completed. (kCLErrorDomain error 1.)
#0 GeolocatorApple.getPositionStream. (package:geolocator_apple/src/geolocator_apple.dart:188:9) #1 Stream.handleError. (dart:async/stream.dart:931:16) #2 _HandleErrorStream._handleError (dart:async/stream_pipe.dart:269:17) #3 _ForwardingStreamSubscription._handleError (dart:async/stream_pipe.dart:157:13) #4 _RootZone.runBinaryGuarded (dart:async/zone.dart:1606:10) #5 _BufferingStreamSubscription._sendError.sendError (dart:async/stream_impl.dart:384:15) #6 _BufferingStreamSubscription._sendError (dart:async/stream_impl.dart:402:7) #7 _BufferingStreamSubscription._addError (dart:async/stream_impl.dart:306:7) #8 _ForwardingStreamSubscription._addError (dart:async/stream_pipe.dart:128:11) #9 _ForwardingStream._handleError (dart:async/stream_pipe.dart:95:10) #10 _ForwardingStream<…>
The application encounters a type conflict and crashes with the error: Unhandled Exception: type '(Position) => Null' is not a subtype of type '((Position) => void)?'. The issue appears when using AppleSettings for iOS in the Geolocator plugin. also when the setting location is on alway or while using the app the location puck shows the first time and disappears and gives this error
Code sample
Code sample
[Paste your code here]
Future<void> _getCurrentLocationForIOS() async {
try {
final geolocator.AppleSettings appleLocationSettings = geolocator.AppleSettings(
accuracy: geolocator.LocationAccuracy.bestForNavigation,
activityType: geolocator.ActivityType.fitness,
distanceFilter:100, // Adjust according to your needs
pauseLocationUpdatesAutomatically:false,
showBackgroundLocationIndicator:true,
allowBackgroundLocationUpdates:true,
);
_currentPosition =await geolocator.Geolocator.getCurrentPosition(
locationSettings: appleLocationSettings,
);
if (!mounted) return;
_mapboxMap.flyTo(
_getCameraOptions(_currentPosition),
MapAnimationOptions(duration:1000),
);
_updateLocationPuck();
} catch (e) {
print("Error getting current location on iOS: $e");
// Handle the error, for example, by showing an alert to the user.
}
}
void_enableLocationUpdatesForIOS() {
final geolocator.AppleSettings appleLocationSettings = geolocator.AppleSettings(
accuracy: geolocator.LocationAccuracy.bestForNavigation,
activityType: geolocator.ActivityType.fitness,
distanceFilter:100, // Adjust according to your needs
pauseLocationUpdatesAutomatically:false,
showBackgroundLocationIndicator:true,
allowBackgroundLocationUpdates:true,
);
geolocator.Geolocator.getPositionStream(
locationSettings: appleLocationSettings,
).listen((geolocator.Position position) {
if (!mounted) return;
setState(() {
_currentPosition = position;
_updateLocationPuck();
});
});
}
</details>
### Screenshots or video
<details><summary>Screenshots or video demonstration</summary>![SimulatorScreenshot- iPhone 15ProMax-2024-08-26 at 141514](https://github.com/user-attachments/assets/bc673bf0-76d0-4072-b967-49365b1c90d6)![simulator_screenshot_3ECC9736-6D9E-4689-A413-3E1DB2F26FFC](https://github.com/user-attachments/assets/424bd4d5-6e32-42bd-8776-1240dd1c465f)<img width="394" alt="Screenshot 2024-08-26 at 3 20 41 PM" src="https://github.com/user-attachments/assets/dbb30237-fc46-4c31-87b7-a893f67230fd">
[Upload media here]
</details>
### Version13.0.1
### FlutterDoctor output
<details><summary>Doctor output</summary>
flutter doctor -v
[✓] Flutter (Channel stable, 3.22.2, on macOS 14.6.1 23G93 darwin-x64, locale
en-US)
• Flutter version 3.22.2on channel stable at
/Users/aditiallady/devlopment/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 761747bfc5 (3 months ago), 2024-06-0522:15:13+0200
• Engine revision edd8546116
• Dart version 3.4.3
• DevTools version 2.34.3
[✓] Android toolchain - develop forAndroid devices (AndroidSDK version 34.0.0)
• AndroidSDK at /Users/aditiallady/Library/Android/sdk
• Platform android-34, build-tools 34.0.0
• Java binary at:/Applications/AndroidStudio.app/Contents/jbr/Contents/Home/bin/java
• Java version OpenJDKRuntimeEnvironment (build
17.0.10+0-17.0.10b1087.21-11572160)
• AllAndroid licenses accepted.
[✓] Xcode- develop for iOS and macOS (Xcode15.4)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 15F31d
• CocoaPods version 1.15.2
[✓] Chrome- develop for the web
• Chrome at /Applications/GoogleChrome.app/Contents/MacOS/GoogleChrome
[✓] AndroidStudio (version 2023.3)
• AndroidStudio at /Applications/AndroidStudio.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 OpenJDKRuntimeEnvironment (build
17.0.10+0-17.0.10b1087.21-11572160)
[✓] VSCode (version 1.92.2)
• VSCode at /Applications/VisualStudioCode.app/Contents
• Flutterextension version 3.94.0
[✓] Connected device (4 available)
• Aditi’s iPhone (mobile) • 00008130-000E21A004298D3A • ios
• iOS 17.5.1 21F90
• iPhone 15ProMax (mobile) • 1F14C548-F714-4573-8B73-4DA1E72B59A1 • ios
• com.apple.CoreSimulator.SimRuntime.iOS-17-5 (simulator)
• macOS (desktop) • macos •
darwin-x64 • macOS 14.6.1 23G93 darwin-x64
• Chrome (web) • chrome •
web-javascript • GoogleChrome128.0.6613.84
[✓] Network resources
• All expected network resources are available.
• No issues found!</details>
The text was updated successfully, but these errors were encountered:
Please check the following before submitting a new issue.
Please select affected platform(s)
Steps to reproduce
Implement location tracking using the Geolocator plugin in a Flutter app.
Create functions _getCurrentLocationForIOS and _enableLocationUpdatesForIOS using AppleSettings for iOS.
Call these functions on an iOS device to get the current location and enable continuous location updates.
Observe the type conflict and other errors during runtime.
Expected results
Example: The application should retrieve the current location and enable continuous location updates on iOS devices without any type conflicts or runtime errors.
Actual results
[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: The operation couldn’t be completed. (kCLErrorDomain error 1.)
#0 GeolocatorApple.getPositionStream. (package:geolocator_apple/src/geolocator_apple.dart:188:9)
#1 Stream.handleError. (dart:async/stream.dart:931:16)
#2 _HandleErrorStream._handleError (dart:async/stream_pipe.dart:269:17)
#3 _ForwardingStreamSubscription._handleError (dart:async/stream_pipe.dart:157:13)
#4 _RootZone.runBinaryGuarded (dart:async/zone.dart:1606:10)
#5 _BufferingStreamSubscription._sendError.sendError (dart:async/stream_impl.dart:384:15)
#6 _BufferingStreamSubscription._sendError (dart:async/stream_impl.dart:402:7)
#7 _BufferingStreamSubscription._addError (dart:async/stream_impl.dart:306:7)
#8 _ForwardingStreamSubscription._addError (dart:async/stream_pipe.dart:128:11)
#9 _ForwardingStream._handleError (dart:async/stream_pipe.dart:95:10)
#10 _ForwardingStream<…>
The application encounters a type conflict and crashes with the error: Unhandled Exception: type '(Position) => Null' is not a subtype of type '((Position) => void)?'. The issue appears when using AppleSettings for iOS in the Geolocator plugin. also when the setting location is on alway or while using the app the location puck shows the first time and disappears and gives this error
Code sample
Code sample
The text was updated successfully, but these errors were encountered: