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.

Unrecognized selector exception when incorrectly using style layers #6736

Closed

Description

@bsudekum

Platform:iOS
Mapbox SDK version:3.4.0.beta-1

Steps to trigger behavior

  1. Create a geojson source
  2. Get a style layer within the current style (labels for example)
  3. Add geojson source to map
  4. Insert geojson below the labels

Example code:

let geoJSON = GeoJSONRoute(coordinates: routes.first!.coordinates! )
let geoJSONSource = MGLGeoJSONSource(identifier: "routeSourceID", geoJSONData: geoJSON.asData()!, options: nil)
let line = MGLLineStyleLayer(identifier: "routeLine", source: geoJSONSource)

let labels = MGLStyleLayer(identifier: "road-label-small")

style().add(geoJSONSource)
style().insert(line, below: labels)

Expected behavior

The geojson layer would be inserted below the labels

Actual behavior

Fatal error at MGLStyle insertLayer; -[MGLStyleLayer layer]: unrecognized selector sent to instance 0x608000216cf0

/cc @boundsj @1ec5

Activity

  1. added
    iOS
    macOS
    on Oct 18, 2016
  2. 1ec5 commented on Oct 18, 2016

    @1ec5
    Contributor
    let labels = MGLStyleLayer(identifier: "road-label-small")

    This line creates a layer; it doesn’t get a layer. To get an existing layer from the style, call style().layer(identifier: "road-label-small").

    Also, if you want to create a style layer, never initialize an MGLStyleLayer directly. Read the MGLStyleLayer documentation for more information.

  3. added this to the ios-v3.4.0 milestone on Oct 18, 2016
  4. 1ec5 commented on Oct 18, 2016

    @1ec5
    Contributor

    The bug here is that the check itself throws an exception rather than taking us far enough to raise a more informative exception.

  5. changed the title [-]Fatal when using `insert(layer, below)`[/-] [+]Unrecognized selector exception when incorrectly using style layers[/+] on Oct 18, 2016
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

    crashiOSmacOSruntime styling

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions