nativescript-community/ui-mapbox

Migrate to a recent Mapbox SDK on iOS, e.g. 10.x

madmas opened this issue · 5 comments

As the current SDK used is 5.1.1 and there is a "warning" from mapbox that those version will no longer be kept compatible after April 2023, we should start to work on a migration in order to keep this plugin working beyond that point.

Bildschirmfoto 2022-09-12 um 20 25 37

Currently, when trying to run with 10.8.1, we get

 ERROR Error: Uncaught (in promise): TypeError: Could not load view for: Mapbox.ReferenceError: MGLMapViewDelegate is not defined
 TypeError: Could not load view for: Mapbox.ReferenceError: MGLMapViewDelegate is not defined
  a

which is, after a quick search in their current docs, a good sign we need a rewrite here....

(and this is probably a good starting point to it: https://docs.mapbox.com/ios/maps/guides/migrate-to-v10/ )

@madmas can you try forcing the pod version in your app podfile?

I think it will be getting tricky to migrate this plugin to using Mapbox SDK 10 on iOS. I already gave it a try to import the latest pod and generate the typings, but it seems impossible right now as NativeScript needs Obj-C backwards compatibility and this seems to be the problem as stated here in the last question:

If your iOS application is written in Objective-C, you will need to write a Swift compatibility shim for those parts of the public API that your application uses. This is because the SDK uses pure Swift constructs that cannot be used from Objective-C directly, for example, associated enums, default values, the Result type and similar.

There is already a Github issue in the Mapbox repo: mapbox/mapbox-maps-ios#358

And also a general discussion in the NativeScript CLI repo: NativeScript/nativescript-cli#5575

@felixkrautschuk indeed if mapbox 10 is in swift without the obj-c comp layer you will have to do that all on your own :(
Definitely means for me that i will stop supporting mapbox sdk.

It seems that a lot has changed for Android too. Similar to the above there's a migration guide https://docs.mapbox.com/android/maps/guides/migrate-to-v10/

Looking at the code for this project it appears to need 8.6.6 which is now an old release of MapBox and does not support 3D maps and the globe projection. While I'd love to help with this I'm not familiar with Nativescript or native app development on iOS or Android so not sure how much help I could be.

I ran into this problem as well today. Is there a way to help migrating this (awesome) plugin to MapBox 10+?
This is by far the best option for using Maps in NativeScript in my opinion.