Mapbox iOS SDK installation using .netrc file
Asked Answered
S

3

10

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

Squander answered 15/9, 2020 at 13:14 Comment(1)
After adding .netrc file content it give me curl: (22) The requested URL returned error: 403 Forbidden error. Any idea?Kibosh
S
14

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
Silvan answered 9/10, 2020 at 9:2 Comment(3)
Thanks for answer. Worked for me.Squander
After adding .netrc file content it give me curl: (22) The requested URL returned error: 403 Forbidden error. Any idea?Kibosh
Then your token was probably missing the Downloads:Read option.Eastwood
R
9

Looks like there is some issue in creating .netrc file. You can use next tips to create a .netrc file before Mapbox installation:

To create .netrc file do next

Fire up Terminal

cd ~ (go to the home directory)

touch .netrc (create file)

open .netrc (open .netrc)

Set required data.

Save

.netrc file should be like this

machine api.mapbox.com login mapbox password <secret_key_created_from_your_mapbox_account>

If you created .netrc file regarding this instruction, mapbox cocoapods should install.

Rearm answered 2/8, 2021 at 5:23 Comment(0)
E
3

https://docs.mapbox.com/ios/navigation/guides/install/

A secret access token with the Downloads:Read scope. From your account's tokens page, click the Create a token button. From the token creation page, give your token a name and make sure the box next to the Downloads:Read scope is checked. Click the Create token button at the bottom of the page to create your token. The token you've created is a secret token, which means you will only have one opportunity to copy it somewhere secure.

Eanes answered 1/3, 2021 at 12:23 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.