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.

No such module 'MapboxMaps' when using $RNMapboxMapsImpl = 'mapbox'

See original GitHub issue

Describe the bug
The project builds fine when following the instructions but once I add the below two lines to the PodFile, the build fails with the error No such module ‘MapboxMaps’, the error is in the rnmapbox-maps pod

$RNMapboxMapsImpl = 'mapbox'
$RNMapboxMapsVersion = '~> 10.4.3'

To Reproduce

  1. Initial Setup
react-native init MapBoxTest --template react-native-template-typescript
npm install rnmapbox/maps#main --save
  1. Perform the token setup as described in this guide
  2. Add the below two line to the PodFile
$RNMapboxMapsImpl = 'mapbox'
$RNMapboxMapsVersion = '~> 10.4.3'
  1. pod install
  2. build

Below are the package.json and PodFile for a project I tried to spawn just to test this issue and it is suffering from the same issue

package.json

{
  "name": "mapboxtest",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "start": "react-native start",
    "test": "jest",
    "lint": "eslint . --ext .js,.jsx,.ts,.tsx"
  },
  "dependencies": {
    "react": "17.0.2",
    "react-native": "0.68.1",
    "@rnmapbox/maps": "github:rnmapbox/maps#main"
  },
  "devDependencies": {
    "@babel/core": "^7.12.9",
    "@babel/runtime": "^7.12.5",
    "@react-native-community/eslint-config": "^2.0.0",
    "@types/jest": "^26.0.23",
    "@types/react-native": "^0.67.3",
    "@types/react-test-renderer": "^17.0.1",
    "@typescript-eslint/eslint-plugin": "^5.17.0",
    "@typescript-eslint/parser": "^5.17.0",
    "babel-jest": "^26.6.3",
    "eslint": "^7.32.0",
    "jest": "^26.6.3",
    "metro-react-native-babel-preset": "^0.67.0",
    "react-test-renderer": "17.0.2",
    "typescript": "^4.4.4"
  },
  "resolutions": {
    "@types/react": "^17"
  },
  "jest": {
    "preset": "react-native",
    "moduleFileExtensions": [
      "ts",
      "tsx",
      "js",
      "jsx",
      "json",
      "node"
    ]
  }
}

PodFile

require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

platform :ios, '11.0'
install! 'cocoapods', :deterministic_uuids => false

target 'MapBoxTest' do
  config = use_native_modules!

  # Flags change depending on the env values.
  flags = get_default_flags()

  use_react_native!(
    :path => config[:reactNativePath],
    # to enable hermes on iOS, change `false` to `true` and then install pods
    :hermes_enabled => flags[:hermes_enabled],
    :fabric_enabled => flags[:fabric_enabled],
    # An absolute path to your application root.
    :app_path => "#{Pod::Config.instance.installation_root}/.."
  )

  target 'MapBoxTestTests' do
    inherit! :complete
    # Pods for testing
  end
  #use_frameworks!
  # Enables Flipper.
  #
  # Note that if you have use_frameworks! enabled, Flipper will not work and
  # you should disable the next line.
  #use_flipper!()
  pod 'MapboxMaps', '10.4.3' 
  $RNMapboxMapsImpl = 'mapbox'
  $RNMapboxMapsVersion = '~> 10.4.3'

  pre_install do |installer|
    $RNMapboxMaps.pre_install(installer)
  end

  post_install do |installer|
    react_native_post_install(installer)
    __apply_Xcode_12_5_M1_post_install_workaround(installer)
    $RNMapboxMaps.post_install(installer)
  end
end

I manually added the line “pod ‘MapboxMaps’, ‘10.4.3’” to try to fix the issue, but still it didn’t fix my issue

Expected behavior
A succesful build

Actual behavior
Build fails with “No such module ‘MapboxMaps’” error

Versions:

  • Platform: [iOS]
  • Platform OS: [Building for iOS 13]
  • Device: [Does not reach the run phase]
  • Emulator/ Simulator: [Does not reach the run phase]
  • Dev OS: [macOS with M1 chip]
  • @rnmapbox/maps Version [10.0.0-beta.1]
  • Mapbox GL version [5.12.1]
  • React Native Version [0.68.0]

Additional context

  • Works fine on Android
  • I tried to manually add the dependencies as described in this MapBox official guide but this didn’t change anything
  • I tried to use use_frameworks! as described in the above guide but this leaded to different errors in other packages and didn’t fix my problem.

Here is a screenshot of rnmapbox-maps pod dependency

Screen Shot 2022-04-19 at 11 39 57 AM

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:14

github_iconTop GitHub Comments

1reaction
Rubenvdveencommented, Aug 1, 2022

@afouadm @ahardy42 I am also experiencing the exact same issue as @SikoraKam . I’ve tried deleting podfile.lock, running pod deintegrate and deleting DerivedData. The error still occurs.

Undefined symbol: _OBJC_CLASS_$_MGLAccountManager

My environment seems to be the same as yours @afouadm , running on M1 mac with "@react-native-mapbox-gl/maps": "^8.5.0" and $ReactNativeMapboxGLIOSVersion = '~> 6.4.1'. Though, I also had to check For install builds only in [CP] Embed Pods Frameworks to avoid getting the error: Multiple commands produce Mapbox.frameworks. That might help?

Any idea what could be wrong? I’m happy to share more information about my environment if needed.

1reaction
SikoraKamcommented, Apr 22, 2022

Guys, one more question, Did anybody build that on MacBook with M1? If I install version from v8 branch and follow their instructions (and also what @afouadm suggested) I get errors about architecture arm64

❌ Undefined symbols for architecture arm64 ┌─ Symbol: OBJC_CLASS$_MGLAccountManager └─ Referenced from: objc-class-ref in libreact-native-mapbox-gl.a(MGLModule.o) ❌ ld: symbol(s) not found for architecture arm64

❌ clang: error: linker command failed with exit code 1 (use -v to see invocation)

@afouadm @ahardy42

That’s why I resigned from 8.5 version and I tried ti implement it with v10 branch and their instructions for using Mapbox-gl instead of maplibre

Read more comments on GitHub >

github_iconTop Results From Across the Web

No such module 'Mapbox' after upgrade to xcode 9
I have installed mapbox as embedded binary and using Carthage without any success :-/ Versions: Xcode 9.0.1; Mapbox 3.6.4; Swift 3.2.
Read more >
Example application is incompatible with CocoaPods #583
produces an error "No such module 'MapboxDirections'" create a podfile ... paste your Mapbox Access Token into MGLMapboxAccessToken in ...
Read more >
Troubleshooting Mapbox Maps and Navigation SDKs for iOS ...
Learn how to troubleshoot issues when installing the Mapbox Maps or Navigation SDK for iOS with Swift Package Manager, CocoaPods, and Carthage.
Read more >
[Solved]-No such module 'Mapbox' after upgrade to xcode 9
Coding example for the question No such module 'Mapbox' after upgrade to xcode 9. ... Using the Facebook iOS SDK in a CI...
Read more >
MapboxNavigation - Swift Package Index
Using Swift Package Manager · Go to your Mapbox account dashboard and create an access token that has the DOWNLOADS:READ scope. PLEASE NOTE:...
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