Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MLNMapViewDelegate on 6.8.0 doesn't work #2993

Open
seraph3b opened this issue Nov 5, 2024 · 12 comments
Open

MLNMapViewDelegate on 6.8.0 doesn't work #2993

seraph3b opened this issue Nov 5, 2024 · 12 comments
Assignees
Labels
bug Something isn't working iOS more info needed Further information is requested

Comments

@seraph3b
Copy link

seraph3b commented Nov 5, 2024

Describe the bug

on 6.8.0 mapViewWillStartLoadingMap, mapViewDidFinishRenderingMap and mapView(_ mapView: MLNMapView, didFinishLoading style: MLNStyle) did not be fired even map appears (guess also mapViewDidFailLoadingMap and so on don't work)

To Reproduce
After loaded a style, map appears but app get stucked waiting for didfinishrenderingmap to continue

Expected behavior
delegate fired

Platform information (please complete the following information):

  • OS: ios 18.1
  • iOS
  • map libre 6.8.0
@seraph3b seraph3b added the bug Something isn't working label Nov 5, 2024
@louwers
Copy link
Collaborator

louwers commented Nov 5, 2024

Please provide a minimal reproduction.

@louwers louwers added more info needed Further information is requested iOS and removed more info needed Further information is requested labels Nov 5, 2024
@louwers
Copy link
Collaborator

louwers commented Nov 5, 2024

I tried to reproduce this, but I was unable.

@seraph3b Can you provide the style this is happening with? Do you see any errors logged?

@seraph3b
Copy link
Author

seraph3b commented Nov 6, 2024

we have 5 different maps and this issue happens with every maps.
only "func mapView(_ mapView: MLNMapView, didFinishLoading style: MLNStyle) {" is fired (tryed on simulator and phisical devices with ios 18+ or ios 15+)

currently using xcode 16.1, swift package manager -> maplibre 6.8.0

with 6.7.1 it works as expected after setting style (self.mapView.styleURL = URL(string:"our map url")), map is loaded and fired:

  • func mapView(_ mapView: MLNMapView, didFinishLoading style: MLNStyle) {
  • func mapViewDidFinishRenderingMap(_ mapView: MLNMapView, fullyRendered: Bool) {

@louwers
Copy link
Collaborator

louwers commented Nov 7, 2024

Thanks.

I'm investigating the issue.

@louwers louwers self-assigned this Nov 7, 2024
@louwers
Copy link
Collaborator

louwers commented Nov 7, 2024

I added these delegate methods to the AnimatedLineExample.swift and used AWS Open Data Standard Light and they fired as expected.

Could you share your style (can be private on Slack) so I can give it a try?

@louwers louwers added the more info needed Further information is requested label Nov 7, 2024
@seraph3b
Copy link
Author

seraph3b commented Nov 7, 2024

@louwers
Copy link
Collaborator

louwers commented Nov 7, 2024

Can you share your code?

This works for me

    func mapView(_ mapView: MLNMapView, didFinishLoading style: MLNStyle) {
        print("Map loaded")
    }
    
    func mapViewDidFinishRenderingMap(_ mapView: MLNMapView, fullyRendered: Bool) {
        print("Map rendered $fullyRendered")
    }

@seraph3b
Copy link
Author

seraph3b commented Nov 7, 2024

on viewdidload:
self.mapView.styleURL = URL(string:"https://tiler.3bmeteo.com/api/maps/bright_v2/style.json")
self.mapView.clearsContextBeforeDrawing = true
self.mapView.maximumZoomLevel = maximumZoomLevel
self.mapView.minimumZoomLevel = minimumZoomLevel

        // se CurrentRadar == swiss_radar limita al nord!
        let sw = CLLocationCoordinate2D(latitude: 35.07638, longitude: 6.402696)
        let ne = CLLocationCoordinate2D(latitude: 47.10169, longitude: 18.5499)
        self.bounds = MLNCoordinateBounds(sw: sw, ne: ne)

        self.mapView.cameraThatFitsCoordinateBounds(self.bounds, edgePadding: UIEdgeInsets(top: 20.0, left: 20.0, bottom: 20.0, right: 20.0))
        
        self.mapView.delegate = self

// other stuff not related to maps

then I wait for
func mapView(_ mapView: MLNMapView, didFinishLoading style: MLNStyle) {
and
func mapViewDidFinishRenderingMap(_ mapView: MLNMapView, fullyRendered: Bool) {

@louwers
Copy link
Collaborator

louwers commented Nov 7, 2024

Could you try passing the style to MLNMapView to see if that makes a difference?

        mapView = MLNMapView(frame: view.bounds, styleURL: URL(string: "https://tiler.3bmeteo.com/api/maps/bright_v2/style.json"))

@seraph3b
Copy link
Author

seraph3b commented Nov 8, 2024

I have a mapView object inside a xib, so self.mapView is a weak outlet to that, I can't set as you suggested

@seraph3b
Copy link
Author

seraph3b commented Nov 8, 2024

It's not an option even I change a lot of code because I need to change style at runtime

@seraph3b
Copy link
Author

seraph3b commented Nov 8, 2024

maybe it's something useful, I set style inside this:
MLNOfflineStorage.shared.setMaximumAmbientCacheSize(102400) { error in
// style set here
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working iOS more info needed Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants