mapbox / mapbox/mapbox-maps-ios

loadStylePack completion never called

Open
#2,369 0 comments 0 reactions 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: 16.4
- iOS version: 18.6
- Devices affected: iOS
- Maps SDK Version:

## Observed behavior and steps to reproduce

When using `OfflineManager.loadStylePack()`, `completion` is never called if `loadStylePack` is called from within a swift concurrency `Task {}` block.

## Expected behavior

The `completion` block should always be called.

## Notes / preliminary analysis

The completion handler on this function seems to be very fragile. Even when not using a swift `Task`, I found I need to call from the worker thread in the `TileStore.default.allTileRegions {}` completion block. Is that expected behavior?
Watching the network traffic I can confirm that the download tasks complete as expected, it is just the completion handler that fails.

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 OfflineManager.loadStylePack() inside a Swift concurrency Task, then compare it with calls from TileStore.default.allTileRegions completion and a worker thread. Trace the loadStylePack completion path and verify that the completion handler is invoked after the download completes in each reported context.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.