Cordova iOS App: Custom Marker Icons for Here Maps not working

173 views Asked by At

Working with Cordova 6.0.0 (iOS 6.1.1) and Here Maps integrated in my app, I keep having trouble with custom marker icons. Running this snippet:

function addMarker(lat, lng){
    
    customicon = new H.map.Icon("img/geo_pin.png", {size: {w: 30, h: 30}});
    
    mymarker = new H.map.Marker({
        lat: lat,
        lng: lng
    }, {
        icon: customicon //works with default marker icon when this line is removed
    });

    map.addObject(mymarker);
}

I just can't get the map to show my custom marker icon. Once I remove the highlighted line of code, I end up with the default marker - no problem.

This is my folder structure:

  • index.html
  • js/map.js (where the code above is running)
  • img/geo_pin.png

I tried all kinds of path variations for the image and even saved the image as a jpg file to check whether maybe the png file might be broken somehow but nothing worked.

Additional note: I am running this piece of code inside my Jquery map.js file.
Any idea what else might be the problem (CORS security)?

1

There are 1 answers

0
Igor P. On BEST ANSWER

According to Cordova iOS Github page, I needed to add these lines to my config.xml file which helped solving the problem:

<preference name="scheme" value="app" />
<preference name="hostname" value="localhost" />