This repository was archived by the owner on May 15, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,9 @@ namespace Xamarin.Essentials
8
8
{
9
9
public static partial class LocationExtensions
10
10
{
11
+ [ System . Runtime . InteropServices . DllImport ( ObjCRuntime . Constants . ObjectiveCLibrary , EntryPoint = "objc_msgSend" ) ]
12
+ public static extern CLAuthorizationStatus CLAuthorizationStatus_objc_msgSend ( IntPtr receiver , IntPtr selector ) ;
13
+
11
14
internal static Location ToLocation ( this CLPlacemark placemark ) =>
12
15
new Location
13
16
{
@@ -52,15 +55,19 @@ internal static DateTimeOffset ToDateTime(this NSDate timestamp)
52
55
53
56
internal static CLAuthorizationStatus GetAuthorizationStatus ( this CLLocationManager locationManager )
54
57
{
55
- #if ! __MACOS__ // this is coming in macOS 11
56
- #if __WATCHOS__
58
+ #if __MACOS__
59
+ if ( DeviceInfo . Version >= new Version ( 11 , 0 ) )
60
+ #elif __WATCHOS__
57
61
if ( Platform . HasOSVersion ( 7 , 0 ) )
58
62
#else
59
63
if ( Platform . HasOSVersion ( 14 , 0 ) )
60
64
#endif
61
- return locationManager . AuthorizationStatus ;
65
+ {
66
+ // return locationManager.AuthorizationStatus;
62
67
63
- #endif
68
+ var sel = ObjCRuntime . Selector . GetHandle ( "authorizationStatus" ) ;
69
+ return CLAuthorizationStatus_objc_msgSend ( locationManager . Handle , sel ) ;
70
+ }
64
71
65
72
return CLLocationManager . Status ;
66
73
}
You can’t perform that action at this time.
0 commit comments