Skip to content
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
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

Closed

Description

@rmnblm

Platform: iOS
Mapbox SDK version: 3.4.0-alpha.4

Steps to trigger behavior

  1. Add a style layer
// Note: StyleLayer is a class variable
styleLayer = MGLCircleStyleLayer(layerIdentifier: "test-layer", sourceIdentifier: "sv")!
styleLayer.circleColor = UIColor.green
mapView.style().add(styleLayer)
  1. Add a UISwitch which basically triggers the following
if (switch.isOn) {
    mapView.style().add(styleLayer)
} else {
    mapView.style().remove(styleLayer)
}
  1. 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.

screen shot 2016-09-26 at 16 33 39

Activity

  1. 1ec5 commented on Sep 26, 2016

    @1ec5
    Contributor

    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(_:).

  2. rmnblm commented on Sep 26, 2016

    @rmnblm
    Author

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions