Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mapbox iOS SDK installation using .netrc file

I'am facing following issue while installing pod.

[!] Error installing Mapbox-iOS-SDK [!] /usr/bin/curl -f -L -o /var/folders/qn/l5lqh07s5sscfzbm1tklmzgr0000gn/T/d20200915-46243-1aqah9u/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 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 curl: (22) The requested URL returned error: 401 Unauthorized

I have added .netrc file in in home directory still facing issue.

Pod Error 1

like image 303
Harsh10 Avatar asked Sep 15 '20 13:09

Harsh10


1 Answers

Since Mapbox 6.x you have to indicate credential to retrieve latest available pod version: https://docs.mapbox.com/ios/maps/overview/#configure-credentials

You can add credential before pod install / pod update process and remove it after with this macos script for example:

echo "Generate credential for mapbox"
echo "machine api.mapbox.com" > ~/.netrc
echo "login mapbox" >> ~/.netrc
echo "password <INSERT API TOKEN>" >> ~/.netrc

To delete this entry later :

sed -i '' -e '/^machine api.mapbox.com$/{N;N;d;}' ~/.netrc
like image 191
Rudy Avatar answered Oct 03 '22 03:10

Rudy