Why I am getting blank page for Mapboxgl api on IOS?
Asked Answered
A

1

9

Working on mapboxgl with ionic3, angular4 and cordova.

I have build .apk and .ipa files. I installed .apk file in my android device it works as expected (ie mapbox tiles, my icons (I have added some icons to custom some functionalities for eg. added an icon to switch the map style) and my markers are loaded successfully).

When I install the .ipa file in my Iphone my icons only loaded but mapbox tiles not getting loaded. Also the markers. I get blank white screen.

What is wrong with my implementation?

let data = {myJson data};

mapboxgl.accessToken = 'My access token';
var map = new mapboxgl.Map({
container: 'map',
style: 'mapbox://styles/mapbox/streets-v9',
attributionControl: false,
center: [-74.50, 40],
zoom: 12
});

map.on('load', function () {
 map.addSource("place", {
    type: "geojson",
   data: data,
   cluster: true,
   clusterMaxZoom: 14, // Max zoom to cluster points on
   clusterRadius: 50 // Radius of each cluster when clustering points (defaults to 50)
});

 map.addLayer({
"id": "places",
"type": "circle",
"source": "place",
"paint": {
  "circle-radius": 7,
  "circle-color": "#32CD32",
  "circle-stroke-width": 4,
  "circle-stroke-color": "#FFFFFF"
}

});

});

Can you help with me with the code added here?

This code works fine in Android. I mean map is loading as expected. But in Iphone My app is working but Map is not loading. Any guess what is wrong?

Ash answered 16/8, 2017 at 10:29 Comment(4)
Still stucking with the same issue. Any solution?Ash
Have you raised an issue on their GitHub page? (github.com/mapbox/mapbox-gl-native) I've had more luck getting responses on there than on SONitroso
Another useful troubleshooting tool is to try download the sample app from their GitHub page and then running it to see if you get the same behaviour. If so, lodge an issue with them on their repo.Satterwhite
@Olive, I raised Issue ticket on that link. But they said they will not support for my architectureAsh
D
5

please check in info.plist for key MGLMapboxAccessToken is set with proper token. this is very important to set this value.

If you don't have source code even thought you can check by extraction IPA. below are step to extract IPA.

  • Change extension from IPA to ZIP.
  • Extract zip file
  • In payload you will find app. right click on it and click on show package contents
  • Open info.plist and search for key and it's value.

I hope you will get your answer

Distrain answered 28/8, 2017 at 12:35 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.