fluttercommunity / fluttercommunity/apple_maps_flutter

Crash in MKPuckAccuracyLayer _updateColors due to CFStringGetLength (iOS)

Open
#81 0 comments 0 reactions 1 assignee Claimed by @LuisThein View on GitHub
bug
Dominant language
Dart
Stars
83
Forks
119
PR merge metrics
No merged PRs in 30d

Description

**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!
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.