mapbox / mapbox/mapbox-maps-ios

OfflineRegionManager invalid `ResponseError.reason` when there is no connectivity

Open
#1,909 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: 14.1
- iOS version: 16.1
- Devices affected: All
- Maps SDK Version: 10.11.0

## Observed behavior and steps to reproduce

We are migrating from V6 SDK and have to keep using the deprecated `OfflineRegionManager` class to download offline maps for some styles because they are not hosted on Mapbox.

We noticed one regression during the migration, when using `OfflineRegionObserver` and implementing `func responseError(forError error: ResponseError)` although `ResponseError.reason` has a `connection` case what we get when there is no network (switch to offline mode for eg) is a `other` reason.

It leads to a degraded user experience because before with V6 we were able to ignore connectivity issues and wait for connectivity to be back. Now we have no way to identify this case and therefore have to make the operation fail and display an error message to our user because when we get an error with `other` reason we don't know if this is due to a network error or something not recoverable.

## Expected behavior

`OfflineRegionObserver.responseError(forError error: ResponseError)` should receive an error with a `connection` reason if the SDK cannot download offline resources due to a network error.

## Notes / preliminary analysis

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 locating OfflineRegionObserver.responseError(forError:) and the ResponseError.reason handling in the SDK, then reproduce the OfflineRegionManager download with connectivity disabled. Compare the reported reason with the expected connection case; done means network failures are distinguishable from other unrecoverable errors.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.