Closed lcr3 closed 7 months ago
@lcr3 Thank you for reporting this issue, I created a ticket in our internal issue tracker https://mapbox.atlassian.net/browse/MAPSFLT-189
Hi @lcr3, this issue should be fixed in https://github.com/mapbox/mapbox-maps-flutter/pull/440, which is released as part of v1.1.0 today.
The app crashes when receiving the onStyleImageMissing event on iOS. did not crash on Android.
System details:
Tested on iOS 17.3.1 mapbox_maps_flutter: ^1.0.0 flutter doctor -v:
ditails
[✓] Flutter (Channel stable, 3.19.2, on macOS 14.3.1 23D60 darwin-arm64, locale ja-JP) • Flutter version 3.19.2 on channel stable at /Users/lcr/fvm/versions/3.19.2 • Upstream repository https://github.com/flutter/flutter.git • Framework revision 7482962148 (11 days ago), 2024-02-27 16:51:22 -0500 • Engine revision 04817c99c9 • Dart version 3.3.0 • DevTools version 2.31.1 [!] Android toolchain - develop for Android devices (Android SDK version 34.0.0) • Android SDK at /Users/lcr/Library/Android/sdk • Platform android-34, build-tools 34.0.0 • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231) ! Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses [✓] Xcode - develop for iOS and macOS (Xcode 15.0) • Xcode at /Applications/Xcode-15.0.0.app/Contents/Developer • Build 15A240d • CocoaPods version 1.15.2 [✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [✓] Android Studio (version 2022.3) • 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 17.0.6+0-17.0.6b829.9-10027231) [✓] VS Code (version 1.86.2) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.84.0 [✓] Connected device (6 available) • Pixel 5a (mobile) • 17151JECB14558 • android-arm64 • Android 14 (API 34) • sdk gphone64 arm64 (mobile) • emulator-5554 • android-arm64 • Android 14 (API 34) (emulator) • liPhone12 mini (2) (mobile) • 00008101-000149220A10001E • ios • iOS 17.3.1 21D61 • iPhone 15 (mobile) • 0365991D-E51E-449F-A6EF-C978D3D6FFAD • ios • com.apple.CoreSimulator.SimRuntime.iOS-17-2 (simulator) • macOS (desktop) • macos • darwin-arm64 • macOS 14.3.1 23D60 darwin-arm64 • Chrome (web) • chrome • web-javascript • Google Chrome 122.0.6261.112 [✓] Network resources • All expected network resources are available.Error code
Cause
The crash occurred because when onStyleImageMissing was called, it attempted to encode an NSDate type, which resulted in the crash.
Solution
Changing timestamp from being of type NSDate to timestamp.microsecondsSince1970 as used in other toJson resolved the crash.
timestamp
->timestamp.microsecondsSince1970
https://github.com/mapbox/mapbox-maps-flutter/blob/e3f17cdf9afb463c048842712f584d26b82845d2/ios/Classes/MapEvents%2BJSON.swift#L116