Skip to content

Crash in MKPuckAccuracyLayer _updateColors due to CFStringGetLength (iOS) #81

Description

@Kiruel

Describe the bug
I am experiencing a crash on iOS when using apple_maps_flutter. The crash occurs on the main thread and seems related to the internal MKPuckAccuracyLayer updating its colors. The stack trace shows a failure in CFStringGetLength downstream of [_MKPuckAccuracyLayer _updateColors]. This appears to be a conflict or race condition when the plugin manually starts location updates while myLocationEnabled is also set to true.

To Reproduce
Steps to reproduce the behavior:

  1. Initialize AppleMap with myLocationEnabled: true.
  2. Run the application on a physical iOS device.
  3. Ensure location permissions are granted and the user location puck is visible.
  4. Stress test the UI by toggling system appearance (Dark/Light mode) or repeatedly backgrounding/foregrounding the app while moving.
  5. See error: App crashes with EXC_BAD_ACCESS in CFStringGetLength.
Crashed: com.apple.main-thread
0  CoreFoundation                 0x5650 CFStringGetLength + 8
...
6  MapKit                         0x55e0c +[UIColor(MKAdditions) _mapkit_colorNamed:compatibleWithTraitCollection:] + 88
7  MapKit                         0xf5fc -[_MKPuckAccuracyLayer _updateColors] + 628

Expected behavior
The application should not crash when displaying the user location, regardless of theme changes or location updates.

Screenshots
N/A

Smartphone (please complete the following information):

  • Device: e.g. iPhone 14
  • Version e.g. iOS 18.6.2

flutter doctor

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.38.3, on macOS 15.7.3 24G419 darwin-arm64, locale en-FR)
[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 16.2)
[✓] Chrome - develop for the web
[✓] Connected device (5 available)
[✓] Network resources

• No issues found!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions