mapbox / mapbox/mapbox-maps-ios

Adding system UIImages to map gives `mismatched image size`

Open
#2,164 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

auto-triaged bug :beetle:
Dominant language
Swift
Stars
601
Forks
196
PR merge metrics
No merged PRs in 30d

Description

## Environment

- Xcode version: 15.3
- iOS version: 17.4
- Devices affected: N/A
- Maps SDK Version: 11.3.0.rc1

## Observed behavior and steps to reproduce

When I try to use the following code to add system `UIImage` to a `MapboxMap` called `map`:

```swift
try map.addImage(
UIImage(systemName: "mappin")!,
id: "pin"
)
```

I get an error: `StyleError(rawValue: "mismatched image size")`.

## Expected behavior

I should be able to use this image the same way I can use images that come from my `Assets`.

## Notes / preliminary analysis

## Additional links and references

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 by reproducing the issue with the `map.addImage` call and a system `UIImage` named `mappin` on the stated Maps SDK, Xcode, and iOS versions. Trace the image-size validation reached by `addImage`; done means system images can be added without `StyleError(rawValue: "mismatched image size")`, while existing asset images continue to work.

Written by the indexing model from the issue text.

Assessment

Tech stack
ios, swift
Domain
mobile-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.