Troubleshooting Mapbox Maps and Navigation SDKs for iOS installation
Learn how to troubleshoot issues when installing the Mapbox Maps or Navigation SDK for iOS with Swift Package Manager, CocoaPods, and Carthage.
General troubleshooting
If you see 401 responses after your app builds successfully, make sure that you've configured all credentials correctly. Note that installing Maps SDK v6.0.0, Navigation SDK v1.0.0, or Search SDK v1.0.0 or greater via Carthage or CocoaPods requires two access tokens: one to download the SDK and another to authenticate map requests.
Swift Package Manager
Swift Package Manager (SPM) is the recommended method for installing the Maps SDK. If you run into issues while installing the framework with SPM, try following these steps:
- Xcode may fail to resolve SPM artifacts with errors such as
artifact of binary target 'MapboxCommon' failed extraction: The operation couldn’t be completed. (TSCBasic.StringError error 1.). If these errors occur, try resetting the SPM cache by opening the File menu in Xcode and selecting Swift Packages > Reset Package Cache. You may also need to delete your derived data folder.
CocoaPods
Though Swift Package Manager is the preferred method for installing the Maps SDK, if you're already using CocoaPods to manage other dependencies in your project, you can also install the Mapbox SDKs for iOS in the same way.
If you run into issues while installing the framework with CocoaPods, try following these steps:
- Use the most recent version of CocoaPods. Beta versions are not recommended for use with the Mapbox Maps SDK for iOS.
- If
pod installgives you an “Unable to find a specification” error, try runningpod repo updatefirst. - When you run
pod install, CocoaPods generates anxcworkspacefile that includes its configuration. Thexcworkspacefile has a white Xcode icon, unlike thexcodeprojfile which has a blue Xcode icon. Make sure you're opening this file and not the original Xcode project. - If you're getting a permission error or having trouble installing CocoaPods itself, consult the CocoaPods troubleshooting documentation.
If you're still having issues using Mapbox with CocoaPods, contact support with the complete details of the issue, including error messages.
Mapbox Maps SDK
-
If you see the error
Mapbox.h not found, this can typically be resolved by building your application despite the error. -
If you're using version v6.0.0 of the SDK or later, you will need to authorize your download of the Maps SDK with a secret access token with the
DOWNLOADS:READscope. Otherwise, you will see the following error:[!] Error installing MapboxMaps
curl: (22) The requested URL returned error: 401 UnauthorizedTo resolve this, create a secret access token from the Access Token page in your Developer Console, and follow the instructions outlined in the installation guide to configure your secret token.
Mapbox Navigation SDK
-
If you're using version v1.0.0 of the SDK or later, you will need to authorize your download of the Navigation SDK with a secret access token with the
DOWNLOADS:READscope. Otherwise, you will see the following error:[!] Error installing MapboxNavigation
curl: (22) The requested URL returned error: 401 UnauthorizedTo resolve this, create a secret access token from the Access Token page in your Developer Console, and follow the instructions outlined in the installation guide to configure your secret token.
Carthage
Mapbox Maps SDK
v10.0.0 and higher
Installation via Carthage is not supported in the Maps SDK for iOS v10.0.0 and higher.
Less than v10.0.0
If you run into issues while installing the framework with Carthage, try following these steps:
-
Make sure you're using Carthage version 0.35.0 or above.
-
If you are encountering an error message like the one below for any Mapbox framework:
*** Downloading binary-only framework MapboxMaps at "https://api.mapbox.com/downloads/v2/mobile-maps-ios/releases/ios/{VERSION_NUMBER}/MapboxMaps.zip"
No available version for binary "https://s3.amazonaws.com/mapbox-ios/accounts/MapboxAccounts.json" satisfies the requirement: ~> 2.3.0You may need to verify that the dependency version specified in your
Cartfileis correct, and then reset theCarthagecache:rm -rf Carthage &&
rm -rf ~/Library/Caches/carthage &&
rm -rf ~/Library/Caches/org.carthage.CarthageKit
-
If you're using version v6.0.0 of the SDK or later, you will need to authorize your download of the Maps SDK with a secret access token with the
DOWNLOADS:READscope. Otherwise, you will see the following error:A shell task (/usr/bin/env unzip -uo -qq -d .@site/src/mapbox-ios-sdk-dynamic.zip) failed with exit code 9:
[.@site/src/mapbox-ios-sdk-dynamic.zip]
End-of-central-directory signature not found. Either this file is not
a zipfile, or it constitutes one disk of a multi-part archive. In the
latter case the central directory and zipfile comment will be found on
the last disk(s) of this archive.
unzip: cannot find zipfile directory in one of .@site/src/mapbox-ios-sdk-dynamic.zip or
.@site/src/mapbox-ios-sdk-dynamic.zip.zip, and cannot find .@site/src/mapbox-ios-sdk-dynamic.zip.ZIP, period.To resolve this, create a secret access token from the Access Token page in your Developer Console, and follow the instructions outlined in the installation guide to configure your secret token.
-
If you continue to run into the same error after including your
~/.netrcfile, try resetting your Carthage cache and try installing again. See cache resetting instructions above.