Overview
This guide covers the iOS-specific setup required for@rnmapbox/maps. The SDK supports Mapbox Maps SDK v11 for iOS.
Prerequisites
- React Native 0.79 or higher
- Node.js (v22.16.0 recommended)
- CocoaPods installed
- Xcode 14 or higher
- Mapbox access token (see Setup Access Token)
Installation Steps
Configure Podfile
Add the required hooks to your
ios/Podfile. These hooks are essential for the Mapbox SDK to work correctly:ios/Podfile
Make sure to add these hooks even if you already have
pre_install and post_install blocks in your Podfile.Install pods
Navigate to the iOS folder and run pod install:This will download the proper Mapbox dependencies.
Configure location permissions (Optional)
If you want to show the user’s current location on the map using the
LocationPuck component, add the location permission to your Info.plist:ios/YourApp/Info.plist
You can customize the permission message to better fit your app’s use case. This message will be shown to users when requesting location access.
Advanced Configuration
Using a Custom Mapbox SDK Version
You can override the default Mapbox SDK version by setting a variable in yourPodfile:
ios/Podfile
Expo Managed Workflow
If you’re using Expo, set theRNMapboxMapsVersion variable through the Expo config plugin instead. See the Expo Setup Guide for details.
Troubleshooting
Pod install fails with “could not find compatible versions”
If you encounter this error when upgrading@rnmapbox/maps:
Build fails after upgrading
- Clean your build folder in Xcode: Product > Clean Build Folder
- Delete
Podfile.lockand thePodsdirectory - Run
pod installagain - Rebuild your project
Location permission not working
Make sure you’ve:- Added
NSLocationWhenInUseUsageDescriptionto yourInfo.plist - Requested location permissions in your app code using React Native’s
PermissionsAndroidor a library likereact-native-permissions
Next Steps
After completing the iOS setup:- Set up your Mapbox access token
- Explore the component documentation
- Check out the example applications
- If you’re also targeting Android, see the Android Setup Guide