Cordova-plugin-googlemaps: iOS: Custom Markers not showing on Master

Created on 25 Apr 2016  路  25Comments  路  Source: mapsplugin/cordova-plugin-googlemaps

Hi,

I've been using the Plugin for a few months now and use it to display different locations through custom image markers. Since i'm working on upgrading my project to cordova ios > 4.x, i've switched to master. Unfortunately the markers are not showing any more, although the success callback is being called on the addMarker() function. Could this be a bug or did you change the API recently or something?

Fwiw, when changing back to my old cordova version (5.4.1) and cordova-ios version (3.9.1), the markers were not showing as well with the master version.

Also, do you have any idea when you'll release a stable 1.4.0 version?

Thanks a lot!

Most helpful comment

@arielgelbard Make sure you have not space in App name, this cause the same problem (file not found according to XCode console with map.setDebuggable(true).

All 25 comments

I think there is still remaining the old plugin.
Please remove the old version completely before install the master version.

The old plugin is definitely not still remaining in my project.

Okay, so I went ahead and compared the master version to the 1.3.9 release. I saw you changed a lot in the Marker.m class, especially concerning the visible flag.
I was able to get regular markers (not the custom images) to show by re-adding the following lines in line 29:
if ([[json valueForKey:@"visible"] boolValue] == true) { marker.map = self.mapCtrl.map; }

This was removed in commit https://github.com/mapsplugin/cordova-plugin-googlemaps/commit/d31c397df51ce893cc6a25c518fa3a143b0309f8#diff-e96d417d7da3951e6660fe8b1e61c612

Please provide example js code that reproduce your issue.

Btw, android is showing the markers and behaving normally.

I'm using the following code in the js side (I cannot give you a full example because i'm working on a productive app):

div = document.getElementById('map_canvas');

map = googleMaps.Map.getMap(div, {
          'backgroundColor': 'white',
          'mapType': googleMaps.MapTypeId.ROADMAP,
          'controls': {
            'compass': true,
            'myLocationButton': true,
            'indoorPicker': false,
            'zoom': false
          },
          'gestures': {
            'scroll': true,
            'tilt': false,
            'rotate': true,
            'zoom': true
          },
          'camera': {
            'latLng': new googleMaps.LatLng(46.801111, 8.226667),
            'zoom': 8,
          }
        });

      map.addMarker({
        position: new googleMaps.LatLng(
          46.801111,
           8.226667
        ),
        icon: {
          url: 'www/assets/images/map_marker.png',
          size: { width: 20, height: 20 },
          anchor:  [10, 10],
        },
        zIndex: 1
});

I did some debugging and found out, that the custom icon is not found in the filesystem. This is probably closely related to the changes in cordova-ios4... when i remove the custom icon, it correctly displays the default icons.

EDIT:
Looks like I found a fix... I might create a PR later/tomorrow

Waiting for the fix :+1: ty man!

@beastmike1 what cordova/cordova-ios/ios versions did you get this bug on?

I'm using ionic, and that are my versions:

$ ionic info
Your system information:

Cordova CLI: 6.1.1
Ionic Version: 1.2.4-nightly-1917
Ionic CLI Version: 1.7.14
Ionic App Lib Version: 0.7.0
ios-deploy version: 1.8.6
ios-sim version: 5.0.3
OS: Mac OS X El Capitan
Node Version: v4.2.2
Xcode version: Xcode 7.3 Build version 7D175

$ cordova platform
Installed platforms:
ios 4.1.1

$ cordova plugin ls
(among other)
com.googlemaps.ios 1.13.0 "Google Map iOS SDK for Cordova"
cordova-plugin-googlemaps 1.3.9 "phonegap-googlemaps-plugin"

thanks. I'll do the PR later today

I did changed the changes on the PR and it didn't worked but then I realized than there was more changes between my file Marker.m and the one from the PR and then I replaced the whole file and it worked at the first try. Thank you very much @Alex-Sessler

Is this fixed? Im having the same issue using master...

You can either manually apply the changes of my PR to your local repo or ask the developers to merge my PR into master

=S is fixed???? XP

Same issue here. Will you merge the PR?

any updates on the issue?

@arielgelbard Make sure you have not space in App name, this cause the same problem (file not found according to XCode console with map.setDebuggable(true).

That worked, thanks! Found a plugin that allows spaces for the app name visually https://github.com/blakgeek/cordova-plugin-app-name

@arielgelbard Nice, plugin-app-name works well 馃巻

Can anyone please help me. i m facing the same issue. custom marker is not showing

Enable debuggable mode as mentioned above and check the XCode console for errors.

@Krishna25Vrinsoft Try to check the url on your marker image file. This is stupid, but I forgot the "www/".

The plugin v2-beta version does not need to "www/" anymore.
And relative path is available.
The v1.x will be shutdown in the near future. Please start to use v2-beta version.

Hi,

Have you a change log for the v2?

Thx

Was this page helpful?
0 / 5 - 0 ratings