0
votes

I am using mapbox sdk iOS, after updating mapbox and navigation sdk to latest release, map view doesn't show my custom style.

Now I use these version of SDKs:

pod 'Mapbox-iOS-SDK', '~> 4.4'
pod 'MapboxNavigation', '~> 0.22'

This is my code and It was working before updating:

let url = URL(string: "https://myapp.ir/dynamic/style_v6.json")
mapView = MGLMapView(frame: view.bounds, styleURL: url)
view.addSubview(mapView)

It shows an empty mapView, with only user location annotation and mapbox logo. But if I use mapbox default style (MGLStyle.darkStyleURL) It works! I have already added mapbox token to info.plist. I get this error:

[ERROR] {}[Setup]: loading style failed: HTTP status code 401
1
Try to find your custom style on site MapBox site and find the correct embed code snippet. I did that recently and my map url is something like: mapbox://styles/**/cjfy2hpjf3e***ubw07 and it works perfectly - Simon Degn

1 Answers

-1
votes

My problem was that I need to add a header to http_file_source file in original-mapbox-gl-native. I need to build a development version of Mapbox Maps SDK for iOS for use in my own Cocoa Touch application. This https://github.com/mapbox/mapbox-gl-native/blob/master/platform/ios/INSTALL.md is what I need to do.