Open FireJuun opened 1 week ago
Hi @FireJuun,
Thanks for reporting this and sharing the suggestion.
While setting NSAllowsArbitraryLoads
to true can indeed resolve network-related issues, it is generally discouraged because it disables secure HTTPS connections for all network requests, potentially exposing data to interception or tampering (Apple's recommendation).
We're investigating alternative solutions that offer a secure yet effective way to address this problem. We'll keep you updated on any safer workarounds or fixes as we progress.
Thanks again for helping us improve the SDK!
Looking forward to a safer workaround. Appreciate the effort here.
@FireJuun,
I was not able to see any effect from setting NSAllowsArbitraryLoads to true, as this issue does not appear to be network-related.
The reason custom locations don’t work as expected, while default simulated locations do, is due to how location updates are handled. With a custom location, the iOS simulator does not trigger continuous location updates, so the app cannot detect any change. In contrast, default simulated locations provide continuous updates, allowing the app to reliably detect the user’s location when the navigation page opens. This limitation should not occur on physical devices, where location services provide continuous updates.
Additionally, there’s a bug in the example app itself:
_userLocation = await _navigationController?.getMyLocation() ?? cameraLocationMIT;
In this line, _navigationController is always null, causing cameraLocationMIT to be used each time if location is not reported by onRoadSnappedLocationUpdatedEvent
on time.
As onRoadSnappedLocationUpdatedEvent
event is never fired with a custom location in the iOS emulator, the location doesn’t update after initialization.
We’re exploring the best approach to tackle this, potentially by exposing the location API directly within the plugin. Additionally, developers can use the location package to fetch the current user location for map initialization.
Note that GoogleMap.myLocation
is deprecated on Google Maps SDK for Android, and therefore for example app purposes, solution to fetch current location would be beneficial.
In testing with the example app on an iOS simulator with a custom location, I am unable to consistently get the app to initialize its user location. Using this with one of the default locations in Simulator is working as intended, however.
I think I have a fix for this as well, but I'm curious if others are able to recreate this issue.
Environment details
Steps to reproduce
.env/development.env
file withMAPS_API_KEY=[[YOUR_API_KEY]]
Default Location (Working)
--dart-define-from-file .env/development.env
Custom Location -- FAILING
--dart-define-from-file .env/development.env
Custom Location -- FIX
info.plist