mapbox / mapbox/mapbox-maps-flutter

When i use "scaleExpression" inside LocationPuck2D it crashed in iOS device and works well with Android.

Open
#320 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Dart
Stars
380
Forks
204
PR merge metrics
No merged PRs in 30d

Description

Below is my code snippet which i am using to get location update in app.
Initially i wasn't able to adjust location pin size but later i found that if i give some value as a String to "scaleExpression" it changes the size of pin.
But it works only on android devices. On iOS device app gets crash with error().

This is code which i am using in my app.
` mapboxMap.location.updateSettings(LocationComponentSettings(
enabled: true,
// puckBearingEnabled: true,
puckBearingSource: PuckBearingSource.COURSE,
locationPuck: LocationPuck(
locationPuck2D: LocationPuck2D(
bearingImage: null,
shadowImage: null,
topImage: list,
scaleExpression: '2')),
));`


This is Error msg getting while app crash on iOS Device.

`mapbox_maps_flutter/LocationController.swift:75: Fatal error: 'try!' expression unexpectedly raised an error: Swift.DecodingError.typeMismatch(Swift.Array, Swift.DecodingError.Context(codingPath: [], debugDescription: "Expected to decode Array but found a number instead.", underlyingError: nil))
mapbox_maps_flutter/LocationController.swift:75: Fatal error: 'try!' expression unexpectedly raised an error: Swift.DecodingError.typeMismatch(Swift.Array, Swift.DecodingError.Context(codingPath: [], debugDescription: "Expected to decode Array but found a number instead.", underlyingError: nil))
thread #1, queue = 'com.apple.main-thread', stop reason = Fatal error: 'try!' expression unexpectedly raised an error: Swift.DecodingError.typeMismatch(Swift.Array, Swift.DecodingError.Context(codingPath: [], debugDescription: "Expected to decode Array but found a number instead.", underlyingError: nil))
frame #0: 0x0000000186a9bebc libswiftCore.dylib`_swift_runtime_on_report
libswiftCore.dylib`:
-> 0x186a9bebc <+0>: ret
libswiftCore.dylib`:
0x186a9bec0 <+0>: b 0x186a9bebc ; _swift_runtime_on_report
libswiftCore.dylib`:
0x186a9bec4 <+0>: adrp x8, 462002
0x186a9bec8 <+4>: ldrb w0, [x8, #0x2cc]
Target 0: (Runner) stopped.`

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the supplied Flutter reproduction and trace scaleExpression from LocationPuck2D into LocationController.swift:75, where the iOS decoding failure is reported. Compare how the value is handled on Android and iOS; done means the setting no longer crashes on an iOS device while the Android behavior remains intact.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart, flutter, swift
Domain
mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.