Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cocoapods - Error installing Mapbox-iOS-SDK

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 ?

like image 255
BSK-Team Avatar asked Sep 22 '20 10:09

BSK-Team


4 Answers

I guess, You are misplacing your .netrc. The .netrc file should be in your home directory (~ on the command line, or use Go ‣ Home in Finder).

  1. In terminal type: cd ~
  2. touch .netrc
  3. open .netrc
  4. paste below to .netrc with SecretKey machine api.mapbox.com login mapbox password
  5. Enjoy: pod install will work without erro
like image 52
Sam Avatar answered Oct 24 '22 19:10

Sam


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.

like image 43
invaderzizim Avatar answered Oct 24 '22 18:10

invaderzizim


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:

  1. Go to Terminal and write cd ~
  2. Press Enter.
  3. Write vi .netrc . It will open the empty file in the terminal.
  4. Press i here to insert data here. When you enter i it will open in insert mode.
  5. Now paste
    machine api.mapbox.com
    login mapbox
    password sk.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Note: Don't put < braces in password >

  1. Press Esc Key from keyboard.
  2. Write :w to write all data on file.
  3. Now write :q to quit from file.
  4. You successfully save the file.
  5. Run Pod install
like image 36
Mustaqeez Ahmad Avatar answered Oct 24 '22 19:10

Mustaqeez Ahmad


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'
like image 23
hooma7n Avatar answered Oct 24 '22 17:10

hooma7n