Reputation: 1810
I want to install last version of Mapbox with Cocoapods.
I configure .netrc
file :
machine api.mapbox.com
login mapbox
password <MY_SECRET_TOKEN>
But when I launch pod install
, I have this error :
[!] Error installing Mapbox-iOS-SDK
[!] /usr/bin/curl -f -L -o /var/folders/vq/jpt1fhxd6fx58rz9zvbdtw000000gn/T/d20200922-35020-qeu6k2/file.zip https://api.mapbox.com/downloads/v2/mobile-maps/releases/ios/packages/6.2.0/mapbox-ios-sdk-dynamic.zip --create-dirs --netrc-optional --retry 2
% 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
How to fix this error ?
Upvotes: 24
Views: 22020
Reputation: 2636
A comprehensive answer that worked for me:
DOWNLOADS:READ
scopemachine api.mapbox.com login mapbox password whatever_token_we_have
Upvotes: 0
Reputation: 1
Open the Pod file of your project and remove pod 'Mapbox-iOS-SDK' and save it and close it . And run pod install
and pod clean
in your terminal and go back to Pod file of your project again and re-write pod 'Mapbox-iOS-SDK' and on your terminal run pod install
.
Upvotes: 0
Reputation: 1
(MAC system) I spent hours on this error and at the end I saw that the .netrc file
is actually written as a netrc file
(without the dot), so even if you rename it, it doesn't work, you have to create the file from terminal, using:
machine <name> login <user>> password <token>
Now with pod repo-art add repoName url
you can connect success
Upvotes: 0
Reputation: 61
When you create your 'Create token' in https://account.mapbox.com/access-tokens, do remember to check the Downloads:Read
scope.
Upvotes: 5
Reputation: 371
This work fo me
Upvotes: 1
Reputation: 93
I searched for fix it so much. but at the end I found the easiest way. You Have to just install lower version instead of 6.3.0
I fixed the issue with version : 4.11.2
and edit your Podfile Like this :
pod 'Mapbox-iOS-SDK', '~> 4.11.2'
Upvotes: 7
Reputation: 541
It took a night for me. After googling too many hours i can't find the best solution to write the secret key on .netrc
file. Please follow the procedure:
machine api.mapbox.com
login mapbox
password sk.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Note: Don't put <
braces in password >
Upvotes: 47
Reputation: 681
That part of the guide might be a bit confusing.
In my case, I realised that the file .netrc
was already in my Home directory. I just had to open a new Terminal and do nano .netrc
. Then I added those 3 lines:
machine api.mapbox.com
login mapbox
password PRIVATE_MAPBOX_API_TOKEN
Upvotes: 8
Reputation: 321
Please make sure that you have saved the .netrc
file in your computer's home directory (not the project's home directory) and that you have pasted your secret token (a new token with the Downloads:Read
scope) into the file.
Upvotes: 13