2

I tried just changing the pod file to have the version '6.1.0' but it ended up giving the error seen below:

[!] Error installing Mapbox-iOS-SDK [!] /usr/bin/curl -f -L -o /var/folders/vn/nddktsy562946cl3l6v3xd740000gn/T/d20200828-4095-1h1x36o/file.zip https://api.mapbox.com/downloads/v2/mobile-maps/releases/ios/packages/6.1.0/mapbox-ios-sdk-dynamic.zip --create-dirs --netrc-optional --retry 2 -A 'CocoaPods/1.9.3 cocoapods-downloader/1.4.0'

% Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 44 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 curl: (22) The requested URL returned error: 401

Then I tried to (as seen in the limited mapbox documentation) edit the .netrc file in the computer's home directory and then tried to run pod install again but that also did not work. Anyone do this yet? Thank you for any help you can provide.

nickcoding
  • 305
  • 8
  • 35

2 Answers2

4

Starting with Mapbox version 6, you will need to authorize your download of the Maps SDK with a secret access token with the Downloads:Read scope. To create a secret access token, follow the steps mentioned here https://docs.mapbox.com/ios/maps/overview/#install-the-maps-sdk. Once created add the access token to your .netrc file in your home directory like this

machine api.mapbox.com 
login mapbox
password <SECRET ACCESS TOKEN>

Once the .netrc file is successfully configured, you should be able to install the mapbox sdk using cocoa pods

Sarthak Mishra
  • 1,033
  • 1
  • 11
  • 27
1

The answers offered above are quite helpful but for an absolute beginner who has never encountered such an issue before and who is new to the UNIX scene, I had a hard time knowing how to configure the .netrc file.

As outlined before, go to your mapbox account and create a new secret token. Create an account if you don't have one then go to MapBox Token's page and click on Create a Token. In the next page, select all token scopes relevant to your project. Ideally, select all. enter image description here

Once that is done, create the token and copy the token created somewhere safe.

On your PC or Mac, open Terminal and type vim ~/.netrc. I chose to use vim but you can use any other text editor such as nano i.e. nano ~/.netrc. It should open a vim edit section like this if the file does not exist or open the existing .netrc file. enter image description here

Click I key on your keyboard to start editing and paste the following code;

machine api.mapbox.com
login mapbox
password <paste your token here>

Replace the <paste your token here> with the token you copied earlier.

Once that is done, press the ESC key and then type :wq to save and exit vim. Your .netrc file should now be configured.

Kenneth Murerwa
  • 778
  • 12
  • 16