flutter-geolocator icon indicating copy to clipboard operation
flutter-geolocator copied to clipboard

Not working on iOS 16

Open Morfeus73 opened this issue 2 years ago • 1 comments

🔙 Regression

The plugin seems not work anymore on iOS 16, Xcode 14.

Old (and correct) behavior

Geolocator.isLocationServiceEnabled() was correclty getting the system service information.

Current behavior

Geolocator.isLocationServiceEnabled() throws

[CoreLocation] This method can cause UI unresponsiveness if invoked on the main thread. Instead, consider waiting for the -locationManagerDidChangeAuthorization: callback and checking authorizationStatus first.

Reproduction steps

Compile the example with Xcode 14 and launch the app on iOS16 device.

Morfeus73 avatar Sep 15 '22 08:09 Morfeus73

Same here!

blubearec avatar Sep 18 '22 13:09 blubearec

I get the same error message.

luttmfra avatar Sep 22 '22 15:09 luttmfra

I'm using Flutter and have a button to bring me to current location which works my device but doesn't work when using the iPhone simulator. But I'm also getting this same error.

Polibuzz avatar Sep 23 '22 14:09 Polibuzz

[CoreLocation] This method can cause UI unresponsiveness if invoked on the main thread. Instead, consider waiting for the -locationManagerDidChangeAuthorization: callback and checking authorizationStatus first.

Waiting for a possible solution. :)

tayyabmughal676 avatar Oct 07 '22 10:10 tayyabmughal676

Is this a duplicate of #1151?

JulianBissekkou avatar Oct 18 '22 08:10 JulianBissekkou

I do see the same logs but the plugin is still able to fetch the localization on iOS 16 on my devices

Tom3652 avatar Oct 25 '22 11:10 Tom3652

I am unable to build my app. Is there a temporary solution?

dario-digregorio avatar Nov 14 '22 09:11 dario-digregorio

is there any solution ?

abdalmonem avatar Dec 26 '22 05:12 abdalmonem

anyone found the solution??

sparshba avatar Jan 05 '23 20:01 sparshba

are we fucked?

This issue needs an urgent solution! Anyone got a solution?

yzengin avatar Feb 02 '23 19:02 yzengin

@yzengin we all agree , i have tried to found another packages , but the issue showed on all of them , we end up our app and prepare it for launch and waiting to solve this to upload it the the appstore :( , such a disappointment thing

abdalmonem avatar Feb 04 '23 07:02 abdalmonem

Needs urgent solution

thealmamun avatar Mar 28 '23 07:03 thealmamun

Guys, make sure you added location permission to info.plist

@abdalmonem did you found a solution for this problem? we also have an app which is ready submit to store.

dungnguyenBKA avatar May 31 '23 06:05 dungnguyenBKA

@dungnguyenBKA yes , looks the issue is not in the plugin it self , we can say its just xcode warning, a lot of time pass , but i remember , i delete the app , clean flutter project then clean x code (product>clean builder folder).

i used this dependencys : geolocator: ^9.0.2 geolocator_apple: ^2.2.5 permission_handler: ^10.2.0

i copy this part from my project , and its work: PermissionStatus permission = await Permission.locationWhenInUse.status; if (permission == PermissionStatus.denied) { await Future.delayed(Duration(microseconds: 200)); // i dont remember why there is delay here , if code works fine , try to remove it, maybe its reverent to permission = await Permission.locationWhenInUse.request(); Position position = await Geolocator.getLastKnownPosition(); Position newPosition = await Geolocator.getCurrentPosition(); }

in my info.plist: <key>NSLocationAlwaysUsageDescription</key> <string>XXX app needs access to location when in the background.</string> <key>NSLocationWhenInUseUsageDescription</key> <string>XXX app needs access to location when open.</string>

for the permission handler , read : https://pub.dev/packages/permission_handler

you need to un comment : 'PERMISSION_LOCATION=1'

abdalmonem avatar Jun 01 '23 06:06 abdalmonem