j20mc / Nativescript-Danem-Google-Maps-Utils

Nativescript Google-maps-utils android & IOS
The Unlicense
6 stars 6 forks source link

iOS setupMarkerCluster error on NativeScript-Vue #3

Open tommag21 opened 4 years ago

tommag21 commented 4 years ago

On iOS, at this line, this is undefined and I get this error: TypeError: undefined must be an object (evaluating 'new WeakRef(this)')

j20mc commented 4 years ago

I just looked, I have no problem (on emulator). How do you encounter this problem and in what way ?

*** init ios map view:
clusterManagerDelegate true <GMUClusterManagerDelegateImpl3: 0x600003548680>
rendererDelegate true <GMUClusterRendererDelegateImpl3: 0x6000035486b0>
GMUDefaultClusterIconGenerator true <GMUDefaultClusterIconGenerator: 0x600003b48180>
GMUNonHierarchicalDistanceBasedAlgorithm  true <GMUNonHierarchicalDistanceBasedAlgorithm: 0x6000031c2540>
GMUDefaultClusterRenderer :  true <GMUDefaultClusterRenderer: 0x600001987880>
GMUClusterManager :  true <GMUClusterManager: 0x60000228fa40>
tommag21 commented 4 years ago

I am on emulator too, I am running the same Android code (nativescript-vue)

<MapView ref="mapViewLoc" @mapReady="onMapReady" />
onMapReady() {
    markerSet = [
        //markers
    ];
    setupMarkerCluster(this.$refs.mapViewLoc.nativeView, markerSet);
}
j20mc commented 4 years ago

I don't know vue.js but in angular, I don't need to go for the nativeView (this.$refs.mapViewLoc.nativeView)

I use it like this : GoogleMapsUtils.setupMarkerCluster(this.mapView, this.makerSet);

j20mc commented 4 years ago

Hello do you still have this problem?

tommag21 commented 4 years ago

Hi, I did not implement clustering after all. When I do I will update this issue, for the moment you can close it

tommag21 commented 3 years ago

Hi, I tried implementing clustering again. Currently running NativeScript-Vue with NativeScript 6.5.0. Plugin version 1.0.18

I have the same problem: in index.ios.js at line 121, this is undefined and new WeakRef(this) throws that error. Replacing the WeakRef with null, I get another error at line 135, which may be a consequence of the replacement:

Error: *** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[8]

I read that you no longer manage this plugin, I'll just leave it here in case someone finds a solution.