简体   繁体   English

使用 .netrc 文件安装 Mapbox iOS SDK

[英]Mapbox iOS SDK installation using .netrc file

I'am facing following issue while installing pod.我在安装 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' [!] 安装 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 % Total % Received % Xferd 平均速度时间时间时间当前下载上传总花费左速度0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 curl: (22) 请求的 URL 返回错误:401 Unauthorized

I have added .netrc file in in home directory still facing issue.我在主目录中添加了 .netrc 文件仍然面临问题。

Pod Error 1 Pod 错误1

Since Mapbox 6.x you have to indicate credential to retrieve latest available pod version: https://docs.mapbox.com/ios/maps/overview/#configure-credentials从 Mapbox 6.x 开始,您必须指明凭据才能检索最新的可用 pod 版本: 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:您可以在 pod install / pod update 过程之前添加凭据,然后使用此 macos 脚本将其删除,例如:

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

https://docs.mapbox.com/ios/navigation/guides/install/ 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.您创建的令牌是一个秘密令牌,这意味着您只有一次机会将它复制到安全的地方。

Looks like there is some issue in creating .netrc file.创建 .netrc 文件时似乎存在一些问题。 You can use next tips to create a .netrc file before Mapbox installation:在安装 Mapbox 之前,您可以使用以下提示创建 .netrc 文件:

To create .netrc file do next要创建 .netrc 文件,请执行下一步

Fire up Terminal启动终端

cd ~ (go to the home directory) cd ~(进入主目录)

touch .netrc (create file)触摸 .netrc(创建文件)

open .netrc (open .netrc)打开 .netrc(打开 .netrc)

Set required data.设置所需数据。

Save节省

.netrc file should be like this .netrc 文件应该是这样的

machine api.mapbox.com login mapbox password <secret_key_created_from_your_mapbox_account> machine api.mapbox.com 登录 mapbox 密码 <secret_key_created_from_your_mapbox_account>

If you created .netrc file regarding this instruction, mapbox cocoapods should install.如果您针对此指令创建了 .netrc 文件,则应该安装 mapbox cocoapods。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM