Unable to install Mapbox iOS SDK - ios

I am trying to install Mapbox iOS SDK using CocoaPod. I have already created the .netrc in the Home directory as suggested:
machine api.mapbox.com
login <my login account>
password <my secret key>
Below are my Pod file
use_frameworks!
target 'MyApp' do
pod 'Mapbox-iOS-SDK', '~> 6.2.1'
end
Below are messages after running 'Pod Update' and 'Pod Install'
Analyzing dependencies
Downloading dependencies
Installing Mapbox-iOS-SDK 6.2.2 (was 6.2.0)
[!] Error installing Mapbox-iOS-SDK
[!] /usr/bin/curl -f -L -o /var/folders/54/rt4ptnd94_j8x3s3_nxn1gfc0000gn/T/d20201108-21218-qopblk/file.zip https://api.mapbox.com/downloads/v2/mobile-maps/releases/ios/packages/6.2.2/mapbox-ios-sdk-dynamic.zip --create-dirs --netrc-optional --retry 2 -A 'CocoaPods/1.10.0 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

To resolve this issue you have to add .netrc in root directory of your Mac not of the project
And follow this example:
machine api.mapbox.com
login mapbox
password your_password

You need to enable the Downloads:Read permission for your secret token.
Configure credentials
From the token creation page, give your token a name and make sure the
box next to the Downloads:Read scope is checked.

This error is occurring due to the improper configuration of public and private key.
you have to do exactly as mentioned in the official documentation (for keys configuration only , if using Flutter )-
https://docs.mapbox.com/ios/maps/guides/install/
You can refer to this video
https://www.youtube.com/watch?v=oFDx6tLipmw&t=441s

Related

Problem running flutter with mapbox-gl in ios

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.

Build Mapbox pod iOS with Kotlin/Native Multiplatform

I'm trying to add Mapbox to Kotlin/Native project, where I use cocoapods:
(already set up for Android - works fine)
//plugin
kotlin("native.cocoapods")
//pod
cocoapods {
// Configure fields required by CocoaPods.
summary = "Some description for a Kotlin/Native module"
homepage = "Link to a Kotlin/Native module homepage"
pod("Mapbox-iOS-SDK", "~> 6.0.0")
}
Pod run through the Kotlin/Native doesn't read .netrc file with credentials:
machine api.mapbox.com
login name
password pass
In pod file I added my library:
pod 'SharedCode', :path => 'kotlin_native/SharedCode'
The error I see when I run pod install:
[!] Error installing Mapbox-iOS-SDK
[!] /usr/bin/curl -f -L -o /var/folders/vk/rb1bs6ld7wd19cmg6srw9s080000gn/T/d20200728-92875-1y3089q/file.zip https://api.mapbox.com/downloads/v2/mobile-maps/releases/ios/packages/6.0.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 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
curl: (22) The requested URL returned error: 401 Unauthorized
If I add pod to iOS project directly, it works ok:
#pod 'Mapbox-iOS-SDK', '~> 5.0.0'
How can I make it read credentials file? Is it possible?
Also, I tried to use podspec and put access_token in the URL but it doesn't work (with or without token), not sure if it is not supported or made syntax mistake?
ArgumentError - Illformed requirement `":podspec => https://github.com/mapbox/pod-specs/blob/master/Mapbox-iOS-SDK/5.2.0/Mapbox-iOS-SDK.podspec"`
this feature is not supported at the moment. Kotlin version 1.4-RC should introduce a possible workaround. One can try calling curl manually and then import local CocoaPods dependency as it is done in this sample.
I would also recommend you to file an issue here(https://kotl.in/issue). Supporting credentials is important, and should be put on the Kotlin team's list.
The login has to be "mapbox" : mapbox documentation : https://docs.mapbox.com/ios/maps/overview/#configure-credentials
machine api.mapbox.com
login mapbox
password <INSERT API TOKEN>
Bonus tips :
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

DJI SDK iOS 4.7 error 403 forbidden with Cocoapods

I'm trying to install DJI-SDK-iOS 4.7 using cocoapods. When I use pod install it shows me this error:
Analyzing dependencies
Downloading dependencies
Installing DJI-SDK-iOS (4.7)
[!] Error installing DJI-SDK-iOS
[!] /usr/bin/curl -f -L -o /var/folders/0b/h5r2v83j12z2n4zymy15m0qc0000gn/T/d20181213-7776-15u9wjf/file.zip http://dh7g4ai1w5iq6.cloudfront.net/ios_sdk/iOS_Mobile_SDK_4.7_180823.zip --create-dirs --netrc-optional --retry 2
% 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: 403 Forbidden
[!] 'DJI-SDK-iOS' uses the unencrypted http protocol to transfer the Pod. Please be sure you're in a safe network with only trusted hosts in there. Please reach out to the library author to notify them of this security issue.
I've tried pod install --repo-update but shows me exactly the same error...
Please use the latest DJI iOS SDK 4.8.1, 4.7 is old and has been removed from Cocoapods.
https://cocoapods.org/pods/DJI-SDK-iOS

react native iOS add firebase with pod encounter 404 error

I need to add firebase in a react native project
I init pod in iOS project and edit pod like below:
platform :ios, '8.0'
target 'ProjectName****' do
pod 'Firebase/Core'
end
after that I run pod install, so the result like below:
Analyzing dependencies
Downloading dependencies
Installing Firebase (4.13.0)
[!] Error installing Firebase [!] /usr/bin/curl -f -L -o /var/folders/8y/24chrcxx1jb20tf7knths56c0000gn/T/d20180505-5700-19mr5c1/file.tgz https://dl.google.com/dl/cpdc/b64ddeea923b5ab5/Firebase-4.13.0.tar.gz --create-dirs --netrc-optional
% 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: 404**
I can not find any solution for this problem. please help me
Not too sure what's going on there; here are a few suggestions:
Run pod update
Try a higher iOS version, I believe cocoapods 1.4+ only supports iOS 9.3
Remove your Pods folder and Podfile.lock and try pod install again

Error while `pod try GooglePlaces`

I am trying to get the demo project provided by Google for Places API using the command pod try GooglePlaces and pod try GooglePlacePicker, but this always fails after few minutes with an error as stated below:
Rohans-MacBook-Pro:~ rohan$ pod try GooglePlaces
Updating spec repositories
CocoaPods 1.2.0.beta.1 is available.
To update use: `sudo gem install cocoapods --pre`
[!] This is a test version we'd love you to try.
For more information, see https://blog.cocoapods.org and the CHANGELOG for this version at https://github.com/CocoaPods/CocoaPods/releases/tag/1.2.0.beta.1
Trying GooglePlaces
[!] /usr/bin/curl -f -L -o /private/var/folders/33/srwyncb13253t9jw7j73v33r0000gn/T/CocoaPods/Try/GooglePlaces/file.tgz https://dl.google.com/dl/cpdc/98bcd61eb763c4a4/GooglePlaces-2.1.1.tar.gz --create-dirs --netrc-optional
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- 0:03:11 --:--:-- 0
curl: (56) SSLRead() return error -9806
Can someone please help me with figuring out what is going wrong?
Note: pod install, pod update, pod setup these commands run properly without any error. I am on macOS Sierra, Xcode 8.1, Cocoapods 1.1.1

Resources