liodali / osm_flutter

OpenStreetMap plugin for flutter
https://pub.dev/packages/flutter_osm_plugin
MIT License
228 stars 95 forks source link

iOS: Doesn't load draw and markers #546

Open KKTadena opened 1 month ago

KKTadena commented 1 month ago

Integration worked in Android but not in iOS

Widget build(BuildContext context) {
    return Scaffold(
      appBar: const PreferredSize(
        preferredSize: Size.fromHeight(kToolbarHeight),
        child: SecondaryAppBar(
          title: 'Tracker View',
        ),
      ),
      body: OSMFlutter(
        controller: _mapController,
        mapIsLoading: const Center(
          child: CircularProgressIndicator(),
        ),
        onMapIsReady: (isReady) async {
          debugPrint('map ready $isReady');
          if (isReady) {
            await _mapController.currentLocation();
            await drawRoutes();
          }
        },
        osmOption: OSMOption(
          zoomOption: const ZoomOption(
            initZoom: 17,
            minZoomLevel: 3,
          ),
          showZoomController: true,
          markerOption: MarkerOption(
            defaultMarker: MarkerIcon(
              iconWidget: Padding(
                padding: const EdgeInsets.only(bottom: 20),
                child: Icon(
                  Icons.person_pin_circle_sharp,
                  color: Constants.SURFACE_COLOR_LIGHT,
                  size: 24,
                ),
              ),
            ),
          ),
        ),
      ),
    );
  }
Future<void> drawRoutes() async {
    debugPrint('geo $geoPoints');
    for (final pin in geoPoints) {
      debugPrint('marked');
      await _mapController.addMarker(pin);
      if (geoPoints.length == 1) {
        await _mapController.goToLocation(pin);
      }
    }

    //// use drawRoadManually to draw straight lines from point to point
    if (geoPoints.length > 1) {
      debugPrint('drawn');
      await _mapController.drawRoadManually(
        geoPoints,
        RoadOption(
          roadColor: Constants.PRIMARY_COLOR,
          roadBorderColor: Constants.onPrimary,
          roadBorderWidth: 10,
          roadWidth: 10,
        ),
      );
    }
  }

Error Log:

flutter: map ready false WARNING sceneLoader.cpp:687: Can't find data source route_line for layer route_line WARNING tileManager.cpp:204: add source mapzen-osm TANGRAM scene.cpp:481: Fetch font https://fonts.gstatic.com/s/opensans/v13/O4NhV7_qs9r9seTo7fnsVLO3LdcAZYWl9Si6vvxL-qU.woff TANGRAM scene.cpp:481: Fetch font https://fonts.gstatic.com/s/opensans/v13/wMws1cEtxWZc6AZZIpiqWALUuEpTyoUstqEm5AMlJo4.woff TANGRAM scene.cpp:481: Fetch font https://fonts.gstatic.com/s/montserrat/v7/zhcz-_WihjSQC0oHJ9TCYL3hpw3pgy2gAi-Ip7WPMi0.woff TANGRAM scene.cpp:427: Fetch texture https://raw.githubusercontent.com/tangrams/bubble-wrap/gh-pages/images/building-grid.gif TANGRAM scene.cpp:427: Fetch texture file:///private/var/containers/Bundle/Application/9D3BACF0-E5A9-4092-AC7E-D4630EFAEBF9/Runner.app/Frameworks/App.framework/flutter_assets/packages/flutter_osm_plugin/assets/mapzen_icon_library Task <3EE44F48-978C-4883-B4DE-3CB035EDA610>.<6> finished with error [-1100] Error Domain=NSURLErrorDomain Code=-1100 "The requested URL was not found on this server." UserInfo={NSLocalizedDescription=The requested URL was not found on this server., NSErrorFailingURLStringKey=file:///private/var/containers/Bundle/Application/9D3BACF0-E5A9-4092-AC7E-D4630EFAEBF9/Runner.app/Frameworks/App.framework/flutter_assets/packages/flutter_osm_plugin/assets/mapzen_icon_library, NSErrorFailingURLKey=file:///private/var/containers/Bundle/Application/9D3BACF0-E5A9-4092-AC7E-D4630EFAEBF9/Runner.app/Frameworks/App.framework/flutter_assets/packages/flutter_osm_plugin/assets/mapzen_icon_library, _NSURLErrorRelatedURLSessionTaskErrorKey=( "LocalDataTask <3EE44F48-978C-4883-B4DE-3CB035EDA610>.<6>" ), _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <3EE44F48-978C-4883-B4DE-3CB035EDA610>.<6>, NSUnderlyingError=0x2838e23a0 {Error Domain=kCFErrorDomainCFNetwork Code=-1100 "(null)"}} TANGRAM scene.cpp:432: Received texture file:///private/var/containers/Bundle/Application/9D3BACF0-E5A9-4092-AC7E-D4630EFAEBF9/Runner.app/Frameworks/App.framework/flutter_assets/packages/flutter_osm_plugin/assets/mapzen_icon_library ERROR scene.cpp:434: Error retrieving URL 'file:///private/var/containers/Bundle/Application/9D3BACF0-E5A9-4092-AC7E-D4630EFAEBF9/Runner.app/Frameworks/App.framework/flutter_assets/packages/flutter_osm_plugin/assets/mapzen_icon_library': The requested URL was not found on this server.

'geo' returns my list data properly 'marked' listed fine 'drawn' log also reached.

But no markers and draw lines made in the map view for iOS.

liodali commented 1 month ago

what version you're using now ?

KKTadena commented 1 month ago

flutter_osm_plugin: ^0.70.4

some devices doesn't load, other device only loads the road boarder color, still doesn't load the markers

liodali commented 1 month ago

use our latest version 1.2.0

KKTadena commented 1 month ago

got it, thanks lemme try to fix other dependencies version conflict.

Thanks for the quick response!