nativescript-community / ui-carto

NativeScript plugin for CARTO Mobile SDK
https://nativescript-community.github.io/ui-carto/
Apache License 2.0
4 stars 1 forks source link

CartoMobileSDK Pod can't be fetched (HTTP 403 Error) #4

Closed Xaver-M-Kienzerle closed 5 months ago

Xaver-M-Kienzerle commented 5 months ago

When installing from a fresh nativescript project and adding @nativescript-community/ui-carto I get the following error during Pod generation:

[!] Error installing CartoMobileSDK
[!] /usr/bin/curl -f -L -o /var/folders/jn/q_8tx4cj2rg08_n1vhv7qh9m0000gn/T/d20240430-36531-s2pew2/file.zip https://nutifront.s3.amazonaws.com/sdk_snapshots/sdk4-ios-4.4.7.zip --create-dirs --netrc-optional --retry 2 -A 'CocoaPods/1.15.2 cocoapods-downloader/2.1'

  % 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

When I access the repo https://nutifront.s3.amazonaws.com/sdk_snapshots/sdk4-ios-4.4.7.zip directly using a browser I get

<Error>
<Code>AccessDenied</Code>
<Message>Access Denied</Message>
<RequestId>6W6ZGA924V4QW7GQ</RequestId>
<HostId>
heJ/wRo6Hw4knu043a7Vw/gBOTs0C1Nk92fp31eCaiCZFCQKuHRCfwxHOvqKn8lJv1ug18/bE6Q=
</HostId>
</Error>

I've tried to access the repo from different IP-Locations in case one of my IPs was all of the sudden blacklisted or whatever but no luck.

Does anybody have any suggestions what to do?

Building the Pod from the GitHub repo failed as well. Does anybody have a working example how to build the CartoMobileSDK on a MacOS (arm)?

Any help would be much appreciated!

Thx in advance.

farfromrefug commented 5 months ago

@Xaver-M-Kienzerle might an issue on Carto side. And seeing they officially dropped carto mobile SDK it might be permanent. However I now maintain a fork (have been for years in fact). I will setup a pod so you can download it. Might take a few days though. I will loom tomorrow if I have the latest version available somewhere in my projects

farfromrefug commented 5 months ago

@Xaver-M-Kienzerle here is the latest iOS release from Carto https://github.com/Akylas/mobile-sdk/releases/tag/release%2Fv4.4.6-rc.1

Xaver-M-Kienzerle commented 5 months ago

@farfromrefug Thank you very much for your quick response and help!

I've downloaded the zip, extracted and put it into platforms/iOS/Pods/CartoMobileSDK like:

$ ls platforms/ios/Pods/CartoMobileSDK/CartoMobileSDK.xcframework
Info.plist                      ios-arm64_armv7                 ios-arm64_i386_x86_64-simulator

But running the project I got the same error as before. It seems I didn't install the pod correctly or the pod install command needs something else to recognize the SDK package?

Could you give me a hint? - I'm not very familiar with the whole cocoa system..

farfromrefug commented 5 months ago

Normal you get the same error as the plugin still tries to get it from the web. Not sure how but from your app podfile you need to say that the CartMobileSDK pod comes a zip or a Dir. Think it is possible

Xaver-M-Kienzerle commented 5 months ago

I've modified the @nativescript-community/ui-carto/platforms/iOS/Podfile to include the path to the zip file ...

pod 'CartoMobileSDK', :path => '~/Downloads/CartoMobileSDK.4.4.7.ios.zip'

... which prevents the download error.

BUT now the issue of a missing "podspec" file aroused:

webpack 5.88.2 compiled successfully in 7444 ms
Webpack compilation complete.
Installing pods...
Analyzing dependencies
[!] No podspec found for `CartoMobileSDK` in `~/Downloads/CartoMobileSDK.4.4.7.ios.zip`

I will keep investigation in the next couple days.

farfromrefug commented 5 months ago

Last solution. Remove the podfile from the plugin and put the xcframework directly there. You might even be able to use patch package to do that automatically with npm install

Xaver-M-Kienzerle commented 5 months ago

I fixed it by providing a custom podspec file which I compiled using the template from https://github.com/CartoDB/scripts/build-ios.py.

My custom podspec file looks like:


Pod::Spec.new do |s|

  s.name         = "CartoMobileSDK"
  s.module_name  = "CartoMobileSDK"
  s.version      = "4.4.7"
  s.summary      = "CARTO Mobile SDK is an advanced MapView with 3D effects, offline maps, routing, geocoding and many more features"

  s.description  = <<-DESC
                   Advanced MapView API

                   * Offline packages for maps, routing and geocoding
                   * Fast vector tile rendering with CartoCSS styling
                   * 2.5D view - tilting, rotating, navigation view
                   * 3D models on map
                   * Use your own custom map data sources
                   * Same API for iOS, Android, Xamarin, Universal Windows Platform

                   By carto.com
                   DESC

  s.homepage     = "https://carto.com/developers/mobile-sdk/"
  s.screenshots  = "https://github.com/CartoDB/mobile-ios-samples/blob/gh-pages/carto-mobile-sdk-animated.gif?raw=true"

  s.license      = { :type => "BSD", :text => <<-LICENSE
                     $license
                     LICENSE
                   }

  s.author             = { "CARTO" => "https://www.carto.com" }
  s.social_media_url   = "https://twitter.com/carto"

  s.platform     = :ios, "9.0"

  s.source       = { :http => "https://github.com/Akylas/mobile-sdk/releases/download/release%2Fv4.4.6-rc.1/CartoMobileSDK.4.4.7.ios.zip" }

  s.source_files  = "CartoMobileSDK.xcframework/**/*.{h,m,mm}"

  s.public_header_files = "CartoMobileSDK.xcframework/**/*.{h}"

  s.preserve_paths = "CartoMobileSDK.xcframework"

  s.frameworks = [ "OpenGLES", "GLKit", "UIKit", "CoreGraphics", "CoreText", "CFNetwork", "Foundation" ]

  s.weak_frameworks = []

  s.vendored_frameworks = "CartoMobileSDK.xcframework"

  s.libraries = "z", "c++"

  s.requires_arc = true

  s.cocoapods_version = ">= 1.10.1"

end

I saved the file to ~/Downloads/CartoMobileSDK.4.4.7.ios.podspec.

Now within the Podfile of the package (@nativescript-community/ui-carto/platforms/iOS/Podfile) I declared the custom podspec like:

pod 'CartoMobileSDK', :podspec => '~/Downloads/CartoMobileSDK.4.4.7.ios.podspec'

Running tns build ios now downloads the SDK from the mirror (provided by @farfromrefug) location and all headers etc. are setup correctly. The build succeeds!

Hope anybody else having this problem might help this. Thanks again @farfromrefug for your help!!

farfromrefug commented 5 months ago

@Xaver-M-Kienzerle indeed that works too and that is about what my new releases podspec is about to look like :D BTW in my fork i will drop almost everything Carto related. It means also no more watermark. Hope that is ok with you.

Xaver-M-Kienzerle commented 5 months ago

Glad you liked the pod spec file. Hopefully it will help others too.

What "watermark" are you referring to?

farfromrefug commented 5 months ago

@Xaver-M-Kienzerle the carto logo that appears on the bottom left of the map

Xaver-M-Kienzerle commented 5 months ago

Just FYI I removed the watermark a while ago by using setWatermarkScale( 0 ) (I use my own tile server therefore I think this is ok)

farfromrefug commented 5 months ago

@Xaver-M-Kienzerle yes i was doing the same. Just so you know : https://github.com/Akylas/mobile-sdk/issues/1

Xaver-M-Kienzerle commented 5 months ago

From my point of view you can close the issue. Thanks again.

farfromrefug commented 3 months ago

@Xaver-M-Kienzerle if you want to test i just published a rc build of my fork https://github.com/Akylas/mobile-sdk/releases/tag/v5.0.0-rc.1. Not released on maven/cocoapod yet. I need to find a new framework name first... WARNING: all carto online stuff + licensing have been removed.