App with openstreetmap not working, if packed with Voltbuilder

openstreetmap has come up before in this forum. Have you searched the discussions there to see if there is anything useful?

I have an openstreetmap + leaflet app

up and running, as a webapp and downloadable Android apk. Can I help with copies of code?

Thank you. The problem is running with downloadable ios ipa. Have you a copy for this that works??

Sorry. I stopped iOS development. No ipa left. I replied anyway just in case you would consider the “universal” code and policy settings useful.

Thank you. Nice, please send your code to gkm@vol.at

I have a Leaflet + openstreetmap IOS application that compiles and works fine.

I had to include the following in the extraheaders on AppStudio, as per this note on the Leaflet site:

"To avoid potential security problems, we recommend and encourage enabling subresource integrity when using Leaflet from a CDN:

<link rel="stylesheet" href="https://unpkg.com/leaflet@1.7.1/dist/leaflet.css"
  integrity="sha512-xodZBNTC5n17Xt2atTPuE1HxjVMSvLVW9ocqUKLsCC5CXdbqCmblAshOMAS6/keqq/sMZMZ19scR4PsZChSR7A=="
  crossorigin=""/>
<script src="https://unpkg.com/leaflet@1.7.1/dist/leaflet.js"
  integrity="sha512-XQoYMqMTK8LvdxXYG3nZ448hOEQiglfqkJs1NOQV44cWnUrBc8PkAOcXy20w0vlaXaVUearIOBhiXZ5V3ynxwA=="
  crossorigin=""></script>
```"

Thank you for your good contribution, but it did not help me. I have always the same error under ios: “Geolocation error: Origin does not have permission to use Geolocation service”.
This is not a openstreetmap or leaflet error, I think it comes from HTML5 navigator (?).

I have changed the Javascript part of the NSB AppStudio example so that it compiles and installs on (my) iPhone running IOS 14.5.1. The “Show Map (Javascript)” button works with my city. I don’t know anything about the BASIC code.

The all important “OnDeviceReady” was added in a try/catch function and the CSP is probably what you already have (content=“default-src *; img-src * ‘self’ data: https:; script-src ‘self’ ‘unsafe-inline’ ‘unsafe-eval’ *; style-src ‘self’ ‘unsafe-inline’ *”). No other changes to the example. See snippet following:


 // NSBasic Container Example using <a href="http://leafletjs.com/">Leaflet</a> Map
 // Magic goes here: NSBasic DIV Container becomes Leaflet DIV map
mapNSB = L.map(mapContainer);

document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() {
  try {
ShowMapJavascriptButton1.onclick = function() {
mapNSB.setView([-33.890937,151.217193], 13);
    // add an OpenStreetMap tile layer
    L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {
      attribution: '&copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
    }).addTo(mapNSB);
    // add a marker in the given location, attach some popup content to it and open the popup
    L.marker([-33.890937,151.217193]).addTo(mapNSB)
      .bindPopup('My city :-)')
      .openPopup();  
    };
  }
  catch(err) {
  alert(" Errror: " +  err.message);
    }
} 

@ gerrit: Sent directly a few minutes ago.

Dear Jim, your Beitrag was very helpfull. It works now for me. Thanks a lot.

Thank you for support and download file. My problem is fixed, my app runs now under ios.

In case someone else runs into this, what did you need to do?

nsb appstudio demo “LeafletMap” runs for me on ios 14.4.2 after packing with Voltbuilder with following extraheaders and config.xml from above discussions: