@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
You will need to authorize your download of the Maps SDK with a secret access token with the DOWNLOADS:READ
scope. This guide explains how to configure the secret token under section Configure your secret token
.
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.
You can also override the version to use. Warning: if you set a version, then later update, the rnamapbox/maps
library it's possible that you'll end up using Mapbox older version than supported. Make sure you revise this value with @rnmapbox/maps
updates. Also note that for 11.0 or later versions you'll need to set $RNMapboxMapsUseV11 = true
, see bellow
# Warning: only for advanced use cases, only do this if you know what you're doing.
# $RNMapboxMapsVersion = '~> 10.16.2'
We have support for mapbox 11.
Add the following to your Podfile:
$RNMapboxMapsVersion = '= 11.1.0'
If using expo managed workflow, set the "RNMapboxMapsVersion" variable. See the expo guide
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