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 was archived by the owner on Aug 8, 2023. It is now read-only.
Repository navigation
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
Crash when adding and removing the same StyleLayer at runtime #6460
// Note: StyleLayer is a class variable
styleLayer = MGLCircleStyleLayer(layerIdentifier: "test-layer", sourceIdentifier: "sv")!
styleLayer.circleColor = UIColor.green
mapView.style().add(styleLayer)
Add a UISwitch which basically triggers the following
if (switch.isOn) {
mapView.style().add(styleLayer)
} else {
mapView.style().remove(styleLayer)
}
Removing the layer works, re-adding the layer will crash the app with the following error message:
2016-09-26 16:19:19.548301 Mapbox-iOS-Examples[892:460381] Failed to set (latitude) user defined inspected property on (UIView): [<UIView 0x101d6e8a0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key latitude.
2016-09-26 16:19:19.548388 Mapbox-iOS-Examples[892:460381] Failed to set (longitude) user defined inspected property on (UIView): [<UIView 0x101d6e8a0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key longitude.
2016-09-26 16:19:19.548446 Mapbox-iOS-Examples[892:460381] Failed to set (zoomLevel) user defined inspected property on (UIView): [<UIView 0x101d6e8a0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key zoomLevel.
Note: I also deleted the latitude, longitude and zoomLevel attributes from the MGLMapView control and also tried to programmatically add the mapView as proposed from @1ec5 in #1184, still doesn't work.
This is due to a combination of #6254 and #6096. For now, you'll need to get a fresh reference to the layer after adding it, using layerWithIdentifier(_:).
Activity
1ec5 commentedon Sep 26, 2016
This is due to a combination of #6254 and #6096. For now, you'll need to get a fresh reference to the layer after adding it, using
layerWithIdentifier(_:).rmnblm commentedon Sep 26, 2016
Thank you, I wasn't sure if I'm doing something wrong or it isn't supported yet. I implemented an example in my Mapbox-iOS-Examples repo here.