question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Click marker doesn't work on iOS, custom marker icon doesn't show neither

See original GitHub issue

Hi,

On android it works, but I don’t know why on ios that tap/click doesn’t fire the function attached to the marker.

this.pits.forEach((item, index) => {
           let a = new GoogleMapsLatLng(item.latitud, item.longitud);
           let am: GoogleMapsMarkerOptions = {
               position: a,
               //icon:"www/assets/images/markers/map-marker-pit.png",
           };
           this.map.addMarker(am)
           .then((marker: GoogleMapsMarker) => {
               console.log('adding  pit marker');
               marker.addEventListener(GoogleMapsEvent.MARKER_CLICK)
           .subscribe(e => {
               console.log('you hit a pit marker');
              this.openPageContenido(item);
           });

           });

       });
       openPageContenido(pit:any){
         console.log('OPENPAGECONTENIDO');
         let cl= new ContenidoList(pit.id,pit.nombre,"");
         this.navCtrl.push( ContenidoPage, {"contenidoList": cl});
      }

So running “ionic run ios -lc” I can see for each marker -> adding pit marker And the map shows all the markers, but If I tap one of them, there is no console log nor openPageContenido is fired.

Any idea?

Btw, I had to add:


.nav-decor{
     display:none!important;
   }

In order to be able to see he map, because otherwise a black screen is over the map. And I don’t know why, my custom markers are not displayed, I tried with different urls but no one worked. Meanwhile I leave them without my custom icon.

I’m using de v2 because in ios I couldn’t install the v1 (https://github.com/mapsplugin/cordova-plugin-googlemaps/issues/1436)

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:27 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
stellasoft-charliecommented, Aug 23, 2017
      map.addMarker(markerOptions).then((marker: Marker) => {
        console.log(marker);
          marker.on(GoogleMapsEvent.INFO_CLICK).subscribe(() => {
            console.log('hello');
        })
      });

Bit late but… This is probably what you’re looking for, works for me.

1reaction
wf9a5m75commented, May 10, 2017

@ferminako Please use three-backslashes to show your code. screen shot 2017-05-10 at 12 28 29 pm

Read more comments on GitHub >

github_iconTop Results From Across the Web

Google Maps API v3: custom markers not clickable on mobile ...
I've narrowed it down to our custom markers. If I remove the code that loads our custom marker images using new google.maps.MarkerImage() ,...
Read more >
GoogleMaps Marker Click doesn't work on IOS - Ionic Forum
I'm using cordova google maps plugin to show native maps. In those maps, I put some markers, and if you tap/click one of...
Read more >
Markers | Maps SDK for Android - Google Developers
Markers indicate single locations on the map. You can customize your markers by changing the default color, or replacing the marker icon with...
Read more >
Google Map, Google Places, custom marker tutorial for iOS in ...
In this video I am gonna show you how to integrate Google map and google places in your app with Cocoapods, how to...
Read more >
Google Map with Custom Marker | Flutter - YouTube
Let's add Google Maps to your Flutter app and replace the boring marker with a fancy one.The first step is getting an API...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found