mapbox / mapbox/mapbox-maps-ios
EXC_BAD_ACCESS in MapboxCoreMaps when loading published Outdoors gallery template
@maios is already working on this.
Since Jun 23, 2026.
- Dominant language
- Swift
- Stars
- 601
- Forks
- 196
- PR merge metrics
- No merged PRs in 30d
Description
# EXC_BAD_ACCESS in MapboxCoreMaps when loading published Outdoors gallery template
## Environment
- Xcode version: 26.4
- iOS version: 26.4 (iPhone 17 Pro Simulator)
- macOS: 26.4.1
- Maps SDK Version: **11.21.1** (also reproduced on 11.21.0)
## Observed behavior and steps to reproduce
Loading a freshly-published, **unmodified** copy of Mapbox's own **Outdoors** gallery template (https://www.mapbox.com/gallery → "Outdoors") in a minimal SwiftUI app crashes the app immediately on first render, inside `MapboxCoreMaps` during `MetalView.draw`.
The same style URI renders correctly in Mapbox Studio's web preview (GL JS), confirming the published style is valid. `MapStyle.standard` (without a custom URI) renders fine in the same minimal app — so the SDK, token, and project setup are all working. The crash is specific to loading a Standard-based custom style published from the Outdoors gallery template.
### Minimal reproduction (~10 lines)
```swift
import SwiftUI
import MapboxMaps
@main
struct MapboxStyleTestApp: App {
var body: some Scene {
WindowGroup { ContentView() }
}
}
struct ContentView: View {
private let styleURI = StyleURI(rawValue: "mapbox://styles//")!
var body: some View {
Map()
.mapStyle(MapStyle(uri: styleURI))
.ignoresSafeArea()
}
}
```
Steps:
1. In Mapbox Studio, open the **Outdoors** gallery template, click "Add to your Studio".
2. Without any edits, click **Publish**.
3. Copy the production Style URL.
4. Paste it into the snippet above.
5. Run on iOS 26.4 simulator (iPhone 17 Pro). App crashes on launch.
## Expected behavior
The Outdoors gallery template — published by Mapbox itself — should render in the iOS SDK the same way it renders in Studio's web preview.
## Crash log (excerpt)
```
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_INVALID_ADDRESS at 0x0000000000000188
Thread 0 Crashed:: com.apple.main-thread
0 MapboxCoreMaps 0x10965cf6c (+ 6721388)
1 MapboxCoreMaps 0x10967404c (+ 6815820)
2 MapboxCoreMaps 0x109609594 (+ 6378900)
3 MapboxCoreMaps 0x10961d5ac (+ 6460844)
4 MapboxCoreMaps 0x10918e158 (+ 1679704)
5 MapboxCoreMaps 0x1091863c8 (+ 1647560)
6 MapboxStyleTest thunk for @escaping @callee_unowned @convention(block) () -> ()
7 MapboxStyleTest MetalView.draw(_:) (MetalView.swift:75)
8 MapboxStyleTest @objc MetalView.draw(_:)
9 MetalKit -[MTKView draw] + 132
10 MapboxStyleTest MapView.updateFromDisplayLink(displayLink:) (MapView.swift:731)
11 MapboxStyleTest closure #1 in MapView.didMoveToWindow() (MapView.swift:773)
```
A `[Warning, mapbox-styles]` is also logged before the crash:
```
The expression config "theme" is missing in style
```
## Notes / preliminary analysis
- Reproduces on a clean SwiftUI project with no custom code paths beyond the snippet above.
- Reproduces with the freshly-published gallery template (no Studio edits) and with a customized derivative.
- Does **not** reproduce when using `MapStyle.standard` or `MapStyle.standard(lightPreset: .night)` — only when loading a Standard-based custom style URI.
- The `expression config "theme" is missing` warning suggests the style references a `["config", "theme"]` expression that isn't resolved at the outer style level, possibly related.
## Additional links and references
Style URI used in repro: mapbox://styles/alpermat/cmo0520w800a501sddzpzcg1k (a freshly-published, unmodified Outdoors gallery template — happy to share the specific URI privately if it helps).
Crash log and the test repo are attached.
[MapboxStyleTest-2026-04-15-172627.ips.zip](https://github.com/user-attachments/files/26753188/MapboxStyleTest-2026-04-15-172627.ips.zip)
[MapboxStyleTest.zip](https://github.com/user-attachments/files/26753209/MapboxStyleTest.zip)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.