You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.
In our Mapbox iOS SDK use case, we get new versions of the stylesheet pushed to the app, which are then stored as files, so styleURL is set to a file URL. Resetting styleURL in this way obviously reloads style and so removes any sources and style layers that I had added for annotations not defined in the stylesheet, and so those sources and style layers need to be recreated. (Yes, when the map reloads the style there is a blip, but it won't happen often at all.)
To make recreating the additional annotations easy, I keep a reference to the added sources and style layers in some arrays and dictionaries. I know I can't reuse the sources and style layers in the new style, but their properties can be copied (e.g., shape) rather than reconstructed. But unfortunately, after the style reloads, accessing the annotation style layers results in a crash. Accessing the sources is OK.
For some annotations, like points, the sources are all MGLShapeSources, and I simply do newShapeSource.shape = oldShapeSource.shape.
Some annotations, tho, track feature IDs in the style layer predicate "id == ". But like I said, trying to access any style layer that was inserted in the previous style results in a crash.
Steps to reproduce
Create a source and style layer and add to style.
Keep a reference to source and to style layer
set a new styleURL
in mapView(_:didFinishLoading:)style, access the style layer by your stored reference -- causes EXC_BAD_ACCESS. At a breakpoint just before the access, po styleLayer in console gives:
Victor Vector(19677,0x116d4e5c0) malloc: can't allocate region
*** mach_vm_map(size=14085975404842041344) failed (error code=3)
Victor Vector(19677,0x116d4e5c0) malloc: *** set a breakpoint in malloc_error_break to debug
expression produced error: error: Execution was interrupted, reason: internal c++ exception breakpoint(-4)..
Full stack trace below.
Expected behavior
The style layer should still exist and be accessible since it is stored in a persistent dictionary or array.
In our Mapbox iOS SDK use case, we get new versions of the stylesheet pushed to the app, which are then stored as files, so
styleURL
is set to a file URL. ResettingstyleURL
in this way obviously reloadsstyle
and so removes any sources and style layers that I had added for annotations not defined in the stylesheet, and so those sources and style layers need to be recreated. (Yes, when the map reloads the style there is a blip, but it won't happen often at all.)To make recreating the additional annotations easy, I keep a reference to the added sources and style layers in some arrays and dictionaries. I know I can't reuse the sources and style layers in the new style, but their properties can be copied (e.g.,
shape
) rather than reconstructed. But unfortunately, after the style reloads, accessing the annotation style layers results in a crash. Accessing the sources is OK.For some annotations, like points, the sources are all
MGLShapeSources
, and I simply donewShapeSource.shape = oldShapeSource.shape
.Some annotations, tho, track feature IDs in the style layer predicate "id == ". But like I said, trying to access any style layer that was inserted in the previous
style
results in a crash.Steps to reproduce
style
.styleURL
mapView(_:didFinishLoading:)
style
, access the style layer by your stored reference -- causes EXC_BAD_ACCESS. At a breakpoint just before the access,po styleLayer
in console gives:Full stack trace below.
Expected behavior
The style layer should still exist and be accessible since it is stored in a persistent dictionary or array.
Actual behavior
Accessing the style layer results in a crash:
Configuration
Mapbox SDK versions: 4.8.0
iOS/macOS versions: 12.1
Device/simulator models: 12.1
Xcode version: 10.1
The text was updated successfully, but these errors were encountered: