ios – Flutter: geolocator Error? Warning? [CoreLocation] This technique may cause UI unresponsiveness if invoked … . I can not get GPS data

0
3


I’m growing in Flutter and am making an attempt to get GPS data utilizing the geolocator package deal.

I used to be in a position to get GPS data on the emulator with no downside, however once I began the app on the precise gadget, I couldn’t get GPS.
The app was working positive, so it was not an error, however there was a message.

“This technique may cause UI unresponsiveness if invoked on the primary thread. As an alternative, take into account ready for the -locationMana gerDidChangeAuthorization: callback and checking authorizationStatus first.”

Code on Flutter aspect

Future<Place> getGps(BuildContext context) async {
    return await Geolocator.getCurrentPosition(
      desiredAccuracy: LocationAccuracy.excessive,
      timeLimit: Length(seconds: 30),
    );
}

(WARNING)Code on IOS aspect

    - (ServiceStatus)checkServiceStatus:(PermissionGroup)permission {
        return [CLLocationManager locationServicesEnabled] ? ServiceSttus Enabled
            : ServiceStatusDisabled;
    }

2023/1/26 added

I had added it to data.plist. Nonetheless, I’m not getting GPS data.

data.plist

<key>NSLocationAlwaysUsageDescription</key>
<string>Entry location data to get a location</string>.
<key>NSLocationWhenInUseUsageDescription</key>
<string>Entry location data to get location</string>

How do I get GPS data?

iOS:16.2
xcode: 14
geolocator: 7.7.1

LEAVE A REPLY

Please enter your comment!
Please enter your name here