maps: [Bug]: (NOBRIDGE) WARN locationManager Error: [Error: RNMBXLocationModule.getLastKnownLocation()Objective C type was unsupported.] [Component Stack]

Mapbox Implementation

Mapbox

Mapbox Version

10.1.31

React Native Version

0.76.3

Platform

iOS

@rnmapbox/maps version

10.0.0-beta.11

Standalone component to reproduce

import React from 'react';
import {
  MapView,
  ShapeSource,
  LineLayer,
  Camera,
} from '@rnmapbox/maps';

const aLine = {
  type: 'LineString',
  coordinates: [
    [-74.00597, 40.71427],
    [-74.00697, 40.71527],
  ],
};

class BugReportExample extends React.Component {
  render() {
    return (
      <MapView style={{flex: 1}}>
        <Camera centerCoordinate={[-74.00597, 40.71427]} zoomLevel={14} />
        <ShapeSource id="idStreetLayer" shape={aLine}>
          <LineLayer id="idStreetLayer" />
        </ShapeSource>
      </MapView>
    );
  }
}

Observed behavior and steps to reproduce

No response

Expected behavior

No response

Notes / preliminary analysis

No response

Additional links and references

No response

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 6
  • Comments: 15 (5 by maintainers)

Most upvoted comments

@mfazekas I’m sorry but I still get the error. (NOBRIDGE) WARN locationManager Error: [Error: RNMBXLocationModule.getLastKnownLocation()Objective C type was unsupported.] [Component Stack]

Dependencies versions:

"@rnmapbox/maps": "10.1.38",
"expo": "~52.0.41",
"react": "18.3.1",
"react-native": "0.76.9",

I have deleted node_modules folder, package lock.json and installed them again. Nothing has changed.

New architecture is enabled. Mapbox version is: “RNMapboxMapsVersion”: “11.8.0”

@mfazekas @vasilring

I fear that the reason why you are still experiencing this issue is due to the fact that ios/RNMBX/RNMBXLocationModuleV11.swift file needs to be updated in the same way ios/RNMBX/RNMBXLocationModule.swift was updated in the pull request that was supposed to fix this issue.

basically, the pull request covers the scenario in which the selected mapbox version is NOT 11. I can tell it because of the macro compiler directive at the top of ios/RNMBX/RNMBXLocationModule.swift: #if !RNMBX_11. This directive excludes those who are using mapbox v 11.

update the v11 file at line 254 replacing the culprit function with the following:

@objc func getLastKnownLocation() -> [String: Any]? {
    let last = RNMBXLocation()
    last.heading = _locationProvider.latestHeading
    last.location = _locationProvider.getLastObservedLocation()
      return last.toJSON()
  }

or simply use this patch file, containing the required changes to make the app run using rn 0.79.1, new arch enabled and mapbox v11.8.0:

@rnmapbox+maps+10.1.38.patch

hopefully it will make the error go away for you too 😊

@whiteHatCip will try to look into over the weekend

I am seeing the same thing with Expo SDK 52 and the new arch.

react-native@0.76.5 @rnmapbox/maps@10.1.33 Native Mapbox v11.6.0, v11.8.0, v11.9.0

Disabling new arch resolves the issue.

same issue here:

“@rnmapbox/maps”: “^10.1.37” “react-native”: “0.78.0”

locationManager Error: [Error: RNMBXLocationModule.getLastKnownLocation()Objective C type was unsupported.] [Component Stack]

“@rnmapbox/maps”: “^10.1.35”, “react-native”: “0.76.6”,

Same issue, any fix for this?

I am having the same issue as well. Do any body figure out what issues this will cause? Other than console log I am not seeing anything to fail particularly.

Same issue on new architecture using

react-native@0.76.5 @rnmapbox/maps@10.1.33

Native ios Mapbox v10.19.0