[Mac Catalyst] Geolocation.GetLocationAsync() is null in MacOs
- Dominant language
- C#
- Stars
- 23.3k
- Forks
- 2k
- Avg merge
- 1d 10h
- Merged PRs (30d)
- 297
Description
### Description
When this code is executed:
```
try
{
var request = new GeolocationRequest(GeolocationAccuracy.Medium, TimeSpan.FromSeconds(10));
#if IOS || MACCATALYST
request.RequestFullAccuracy = true;
#endif
CancellationTokenSource cts = new CancellationTokenSource();
var location = await Geolocation.GetLocationAsync(request, cts.Token);
if (location != null)
{
Console.WriteLine($"Latitude: {location.Latitude}, Longitude: {location.Longitude}, Altitude: {location.Altitude}");
}
return location;
}
catch (FeatureNotSupportedException fnsEx)
{
// Handle not supported on device exception
return null;
}
catch (FeatureNotEnabledException fneEx)
{
// Handle not enabled on device exception
return null;
}
catch (PermissionException pEx)
{
// Handle permission exception
return null;
}
catch (Exception ex)
{
// Unable to get location
return null;
}
```
The variable location always is null. the variable location works in platforms: android, ios. windows I haven't tried it.
i have this permissions:
```
NSLocationTemporaryUsageDescriptionDictionary
TemporaryFullAccuracyUsageDescription
Fill in a reason why your app needs full accuracy
NSLocationUsageDescription
Fill in a reason why your app needs access to location.
NSLocationWhenInUseUsageDescription
Fill in a reason why your app needs access to location.
```
### Steps to Reproduce
Create a New .NET MAUI App
### Version with bug
6.0.400
### Last version that worked well
Unknown/Other
### Affected platforms
macOS
### Affected platform versions
macos 12.3.1
### Did you find any workaround?
_No response_
### Relevant log output
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.