Skip to content

[BUG] iOS build fails with "Member not found" for MyLocationTrackingMode.(Tracking/TrackingCompass) and MyLocationRenderMode.COMPASS #573

@etan15

Description

@etan15

Platforms

iOS

Version of flutter maplibre_gl

0.21.0 (using ^0.21.0 in pubspec.yaml, resolved to 0.21.0)

Bug Description

Building a Flutter application for iOS fails when specific enum values (Tracking, TrackingCompass, COMPASS) are used for myLocationTrackingMode or myLocationRenderMode properties of the MapLibreMap widget. The build succeeds if these properties are commented out or potentially set to None/NORMAL. This prevents the use of essential map tracking and user location rendering features on iOS.

Steps to Reproduce

  1. Create a Flutter project using maplibre_gl: ^0.21.0.
  2. Add a MapLibreMap widget to a screen.
  3. Set the myLocationEnabled property to true.
  4. Set the myLocationTrackingMode property to maplibre_gl.MyLocationTrackingMode.TrackingCompass OR maplibre_gl.MyLocationTrackingMode.Tracking.
  5. Alternatively, or additionally, set the myLocationRenderMode property to maplibre_gl.MyLocationRenderMode.COMPASS.
  6. Attempt to build the application for an iOS device or simulator (e.g., flutter build ios --no-codesign).

Expected Results

The iOS build should complete successfully, allowing the application to run with the specified location tracking and rendering modes active.

Actual Results

The iOS build fails during the Xcode build phase with one of the following errors, depending on which enum value was used:

  • When using MyLocationTrackingMode.TrackingCompass:
    Error (Xcode): lib/your_file.dart:line:col: Error: Member not found: 'TrackingCompass'.

  • When using MyLocationTrackingMode.Tracking:
    Error (Xcode): lib/your_file.dart:line:col: Error: Member not found: 'Tracking'.

  • When using MyLocationRenderMode.COMPASS:
    Error (Xcode): lib/your_file.dart:line:col: Error: Member not found: 'COMPASS'.

(Replace your_file.dart:line:col with the actual location from the build error log).

Code Sample

// import 'package:flutter/material.dart';
import 'package:maplibre_gl/maplibre_gl.dart' as maplibre_gl;

class MapScreen extends StatefulWidget {
  const MapScreen({Key? key}) : super(key: key);

  @override
  State<MapScreen> createState() => _MapScreenState();
}

class _MapScreenState extends State<MapScreen> {
  maplibre_gl.MapLibreMapController? _mapController;

  void _onMapCreated(maplibre_gl.MapLibreMapController controller) {
    _mapController = controller;
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: maplibre_gl.MapLibreMap(
        onMapCreated: _onMapCreated,
        initialCameraPosition: const maplibre_gl.CameraPosition(
          target: maplibre_gl.LatLng(0, 0), // Replace with desired initial position
          zoom: 14.0,
        ),
        styleString: 'YOUR_MAP_STYLE_URL_OR_JSON', // Replace with your map style
        myLocationEnabled: true,

        // *** These lines cause the iOS build failure in v0.21.0 ***
        myLocationTrackingMode: maplibre_gl.MyLocationTrackingMode.TrackingCompass, // Fails build
        // myLocationTrackingMode: maplibre_gl.MyLocationTrackingMode.Tracking, // Also fails build
        // myLocationRenderMode: maplibre_gl.MyLocationRenderMode.COMPASS, // Also fails build

        // Build succeeds if the above lines are commented out or potentially set to .None / .NORMAL
         myLocationTrackingMode: maplibre_gl.MyLocationTrackingMode.None, // Build OK
         myLocationRenderMode: maplibre_gl.MyLocationRenderMode.NORMAL, // Build OK


        trackCameraPosition: true, // Recommended when using location tracking
      ),
    );
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions