mapbox / mapbox/mapbox-maps-ios

MapView does not render until after system alert (e.g., notification permission) is dismissed

Open
#2,327 0 comments 0 reactions 1 assignee View on GitHub

@maios is already working on this.

Since Jun 9, 2025.

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

Description

## Environment

- Xcode version: All
- iOS version: All
- Devices affected: All
- Maps SDK Version: All

## Observed behavior and steps to reproduce

When initializing and adding a MapView inside viewDidAppear, the map does not appear until after a system alert (like the UNUserNotificationCenter permission prompt) is dismissed. This is inconsistent with system frameworks like MKMapView, which renders immediately even while such alerts are visible.

1. In viewDidAppear, request notification permission and add the MapView:
```
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)

UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .sound, .badge]) { _, _ in }

let mapView = MapView(frame: view.bounds)
mapView.translatesAutoresizingMaskIntoConstraints = false
view.addSubview(mapView)

NSLayoutConstraint.activate([
mapView.topAnchor.constraint(equalTo: view.topAnchor),
mapView.bottomAnchor.constraint(equalTo: view.bottomAnchor),
mapView.leadingAnchor.constraint(equalTo: view.leadingAnchor),
mapView.trailingAnchor.constraint(equalTo: view.trailingAnchor)
])
}
```
2. Run the app for the first time so the notification permission alert is triggered.
3. Observe that the MapView does not appear until after the alert is dismissed.

## Expected behavior

Mapbox’s MapView should render immediately after being added to the view hierarchy, even when a system alert is visible — similar to how MKMapView behaves.

## Additional links and references

https://github.com/user-attachments/assets/8982d69e-5baa-4daa-aba0-d48a5d053e4f

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.