1

I am migrating from Mapbox 6 to Mapbox 10. I have a source, which needs a authorisation header in order to be accessed. Unfortunately, can't find a way to set the authorisation header for the source:

let vectorSource = VectorSource()
vectorSource.tiles = ["www.demo-endpoint.com/demo-tiles"]
// In order to access the endpoint, we need to set the authorisation header.
// Can't find an option to define it here

In Mapbox 6, I was able to register a URLProtocol subclass to interfere the requests and set the header:

let config = MGLNetworkConfiguration.sharedManager.sessionConfiguration
config?.protocolClasses = [protocolClass.self] // Custom `URLProtocol` subclass
MGLNetworkConfiguration.sharedManager.sessionConfiguration = config

Is there such an option in Mapbox 10 ?

πter
  • 1,899
  • 2
  • 9
  • 23
  • Looking for this as well, but in order to set `MGLNetworkConfiguration.sharedManager.connected` to `false` (to force offline mode) – Ilia Sidorenko May 10 '23 at 03:57

0 Answers0