Closed michaelkirk closed 5 months ago
Update: I added a UIKit (non SwiftUI) App to my example repository and have confirmed the issue exists there as well.
I was able to see a map rendered if I commented out these lines in NavigationViewController.swift
:
public func styleManager(_ styleManager: StyleManager, didApply style: Style) {
// if self.mapView?.styleURL != style.mapStyleURL {
// self.mapView?.style?.transition = MLNTransition(duration: 0.5, delay: 0)
// self.mapView?.styleURL = style.mapStyleURL
// }
self.currentStatusBarStyle = style.statusBarStyle ?? .default
setNeedsStatusBarAppearanceUpdate()
}
These are the values:
self.mapView?.styleURL = `maplibre://maps/style`
style.mapStyleURL = `mapbox://styles/mapbox/navigation-guidance-night-v4`
Should the mapbox URLs in MLNStyle.swift be updated to point to something maplibre?
I can pass in a custom style object with the proper URL to NavigationViewController(.... styles: [myCustomStyle])
. But it's not quite trivial, because we still probably want to respect day vs. night.
Regardless of all that though, I'd expect the map style to change if the new style doesn't match the default style rather than to just print a blank view.
Another thing - the map is very flickery while navigating. I don't experience this while panning the map.
It's true on both simulator and a physical device. I'm assuming that's a separate issue. I'll follow up with a new ticket and minimal example for that one tomorrow.
Should the mapbox URLs in MLNStyle.swift be updated to point to something maplibre?
Yes, actually the whole Mapbox Style part should be removed. The mapbox:// don't work anymore I think, so we should remove these. PRs would be very welcome, if you would like to work on this?
I think we should do two things:
I can pass in a custom style object with the proper URL to NavigationViewController(.... styles: [myCustomStyle]). But it's not quite trivial, because we still probably want to respect day vs. night.
Yes this currently works and you can handle the day and night switch in your app as well.
Another thing - the map is very flickery while navigating. I don't experience this while panning the map.
What do you mean with flickery? In the simulator it is very flickery and weird, but this does not happen on a real device. A new issue for this would make sense.
Another thing - the map is very flickery while navigating. I don't experience this while panning the map. It's true on both simulator and a physical device.
What do you mean with flickery? In the simulator it is very flickery and weird, but this does not happen on a real device. A new issue for this would make sense.
You can see an example of the flickering from the earlier screen capture I uploaded. The green base map is flashing in and out of visibility while the blue route line is solid. This was happening on simulator and a real device. The problem seemed to go away when I switched to my own style rather than the maplibre default style, so I haven't looked into it further. I'm not sure if it's related to switching styles or some other issue.
Yes, actually the whole Mapbox Style part should be removed. The mapbox:// don't work anymore I think, so we should remove these. PRs would be very welcome, if you would like to work on this?
Sure, I'll take a stab at something.
Steps to Trigger Behavior
Link to Minimal Reproducible Example
https://github.com/michaelkirk/maplibre-navigation-ios-example-app/tree/mkirk/navigation-view-controller-blank
Expected Behavior
I expect some kind of map to be rendered.
Actual Behavior
Other UI is rendered, like the controls and user location puck, but the base map is just solid gray.
Screenshots (if applicable)
Version(s) affected
Additional context
I'm using the NavigationViewController in SwiftUI via
ViewControllerRepresentable
. I haven't tried it in a non Swift UI app yet.I can render a
MapView
andNavigationMapView
just fine on it's own (viaViewRepresentable
). It seems to only be an issue in the context of theNavigationViewController
: