question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

iOS crash when adding a HeatmapLayer

See original GitHub issue

Describe the bug
This library appears to crash on iOS any time there is a HeatmapLayer in a map.

To Reproduce
Add any HeatmapLayer to a map and react-native run-ios. The app will crash

I have created a minimal repository that causes the crash on iOS. https://github.com/zholmes1/MapboxHeatmapExample

Crash report: https://raw.githubusercontent.com/zholmes1/MapboxHeatmapExample/master/MapboxHeatmapExample_2021-02-08-190724_Zachs-MacBook-Pro.crash

Example:

import React, {Component} from 'react';
import {StyleSheet, View} from 'react-native';
import MapboxGL from '@react-native-mapbox-gl/maps';

MapboxGL.setAccessToken('YOUR-ACCESS-TOKEN');

const styles = StyleSheet.create({
  page: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
    backgroundColor: '#F5FCFF',
  },
  container: {
    height: 300,
    width: 300,
    backgroundColor: 'tomato',
  },
  map: {
    flex: 1,
  },
});

export default class App extends Component {
  componentDidMount() {
    MapboxGL.setTelemetryEnabled(false);
  }

  render() {
    return (
      <View style={styles.page}>
        <View style={styles.container}>
          <MapboxGL.MapView style={styles.map}>
            <MapboxGL.VectorSource
              id="occurrence"
              tileUrlTemplates={[
                `https://api.gbif.org/v2/map/occurrence/density/{z}/{x}/{y}.mvt?taxonKey=8671098`,
              ]}>
              <MapboxGL.HeatmapLayer
                id="occurrence"
                sourceID="occurrence"
                sourceLayerID="occurrence"
                style={{
                  heatmapOpacity: 0.5,
                  heatmapRadius: [
                    'interpolate',
                    ['linear'],
                    ['zoom'],
                    0,
                    2,
                    9,
                    20,
                  ],
                }}
              />
            </MapboxGL.VectorSource>
          </MapboxGL.MapView>
        </View>
      </View>
    );
  }
}

Expected behavior
HeatmapLayer works properly on iOS

Actual behavior
App hard crashes

Versions (please complete the following information):

  • Platform: iOS
  • Platform OS: 14.1
  • Device: iPhone 11
  • Emulator/ Simulator: Both
  • Dev OS: macOS 11.1
  • react-native-mapbox-gl Version: 8.1.0
  • React Native Version: 0.63.4

Other It appears this crash was documented in 2019 in the mapbox-gl-native repository. There was a merged into that repository that was meant to fix this crash. https://github.com/mapbox/mapbox-gl-native/issues/14807

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:3
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
ferdicuscommented, May 16, 2021

@zholmes1 , btw, I’ve found what’s causing the warning - it’s based on a change introduced by the upstream SDKs: ios / android

It’s annoying, however I think it’s save to ignore

1reaction
zholmes1commented, Feb 9, 2021

Okay great! Thanks for the quick resolution to this. I’ll leave it up to you whether this issue should be closed or not. It will take care of itself whenever this repo updates to the 6.3 iOS SDK.

Read more comments on GitHub >

github_iconTop Results From Across the Web

iOS crash when adding a HeatmapLayer · Issue #1211 - GitHub
Describe the bug This library appears to crash on iOS any time there is a HeatmapLayer in a map. To Reproduce Add any...
Read more >
iOS 13 crash on MapKit at -[MKTile… | Apple Developer Forums
I am adding the overlay async, so this is not the cause for the crash. What I know so far is that the...
Read more >
Heatmap in Google Maps SDK for iOS - Stack Overflow
Heatmaps don't appear to be supported by the iOS SDK. However, you could try something like LFHeatMap which allows you to generate a...
Read more >
Crash Heat Map
Date: 1/17/2020. Locations are approximate. Data Source: TxDOT Crash Records Information System Query. W. Division St.
Read more >
[Solved]-Google Maps iOS + Storyboard + Segue = Crash
To stop it from crashing, you need to use the main thread instead. Wrap your performSegueWithIdentifier:sender: as follows to use the main thread:...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found