I am trying to install mapbox in my flutter app:
dependencies:
mapbox_gl: ^0.16.0
and I have been following the guidelines from https://docs.mapbox.com/ios/maps/guides/install/ and https://pub.dev/packages/mapbox_gl#secret-mapbox-access-token to start using it in iOs xcode simulator.
When flutter automatically runs pod install, it comes up with the error
Error output from CocoaPods: ↳ % Total % Received % Xferd
Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed 0 39 0 0
0 0 0 0 –:–:– –:–:– –:–:– 0 curl:
(22) The requested URL returned error: 401
My .netrc is located in ~/ directory.
~/.netrc reads as follows:
machine api.mapbox.com
login mapbox
password sk.xxxxxxx…..xxxxxx
and the secret token does have the Download:read scope
Am I missing something?
I have tried running flutter in macos directly and it works perfectly,I have tried to install mapbox.gl packages from xcode project also and it works, but when I run flutter it tries to install them via pod eitherway and it comes up with the same error.
2
Answers
Had seemingly the same issue locally, deleted and re-created the .netrc file using vi which resolved the issue (previously had been using TextEdit). I followed steps below:
Note: Replace <sk.xxxx> with your Mapbox key.
If you still get 401 error after following these steps, you can update your PATH variable for the current session at the command line for .netrc file.
Try this before
pod install
orflutter run
command.