Skip to content

Latest commit

 

History

History
78 lines (50 loc) · 1.95 KB

File metadata and controls

78 lines (50 loc) · 1.95 KB

iOS Installation

@rnmapbox/maps via npm or yarn.


Add the following to your ios/Podfile:

  pre_install do |installer|
    $RNMapboxMaps.pre_install(installer)
    ... other pre install hooks
  end
  post_install do |installer|
    $RNMapboxMaps.post_install(installer)
    ... other post install hooks
  end

Run pod install to download the proper mapbox dependency.

# Go to the ios folder
cd ios

# Run Pod Install
pod install

If you want to show the user's current location on the map with the LocationPuck component, you'll need to add the following property to your Info.plist (see Mapbox iOS docs for more info):

<key>NSLocationWhenInUseUsageDescription</key>
<string>Show current location on map.</string>

You are good to go!

Read on if you want to edit your Mapbox version or flavor.


Using a custom version of the Mapbox SDK

You can override the version to use. Warning: if you set a version, then later update the @rnmapbox/maps library it's possible that you'll end up using an older Mapbox version than supported. Make sure you revise this value with @rnmapbox/maps updates.

$RNMapboxMapsVersion = '= 11.16.2'

If using expo managed workflow, set the "RNMapboxMapsVersion" variable. See the expo guide

Troubleshooting

Pod install fails on upgrade of @rnmapbox/maps with could not find compatible versions for pod "MapboxMaps"

Example message:

[!] CocoaPods could not find compatible versions for pod "MapboxMaps":
  In snapshot (Podfile.lock):
    MapboxMaps (= 10.15.0, ~> 10.15.0)

  In Podfile:
    rnmapbox-maps (from `../node_modules/@rnmapbox/maps`) was resolved to 10.0.15, which depends on
      MapboxMaps (~> 10.16.0)

Please use pod update MapboxMaps as suggested by cocoapods