@@ -158,13 +158,23 @@ public final class AsyncLocationManager {
158158 let authorizationPerformer = RequestAuthorizationPerformer ( )
159159 return await withTaskCancellationHandler ( operation: {
160160 await withCheckedContinuation { continuation in
161+ #if os(macOS)
162+ if #available( iOS 14 , * ) , locationManager. authorizationStatus != . notDetermined {
163+ continuation. resume ( with: . success( locationManager. authorizationStatus) )
164+ } else {
165+ authorizationPerformer. linkContinuation ( continuation)
166+ proxyDelegate. addPerformer ( authorizationPerformer)
167+ locationManager. requestAlwaysAuthorization ( )
168+ }
169+ #else
161170 if #available( iOS 14 , * ) , locationManager. authorizationStatus != . notDetermined && locationManager. authorizationStatus != . authorizedWhenInUse {
162171 continuation. resume ( with: . success( locationManager. authorizationStatus) )
163172 } else {
164173 authorizationPerformer. linkContinuation ( continuation)
165174 proxyDelegate. addPerformer ( authorizationPerformer)
166175 locationManager. requestAlwaysAuthorization ( )
167176 }
177+ #endif
168178 }
169179 } , onCancel: {
170180 proxyDelegate. cancel ( for: authorizationPerformer. uniqueIdentifier)
@@ -327,13 +337,23 @@ extension AsyncLocationManager {
327337 let authorizationPerformer = RequestAuthorizationPerformer ( )
328338 return await withTaskCancellationHandler ( operation: {
329339 await withCheckedContinuation { continuation in
340+ #if os(macOS)
341+ if #available( iOS 14 , watchOS 7 , * ) , locationManager. authorizationStatus != . notDetermined {
342+ continuation. resume ( with: . success( locationManager. authorizationStatus) )
343+ } else {
344+ authorizationPerformer. linkContinuation ( continuation)
345+ proxyDelegate. addPerformer ( authorizationPerformer)
346+ locationManager. requestAlwaysAuthorization ( )
347+ }
348+ #else
330349 if #available( iOS 14 , watchOS 7 , * ) , locationManager. authorizationStatus != . notDetermined && locationManager. authorizationStatus != . authorizedWhenInUse {
331350 continuation. resume ( with: . success( locationManager. authorizationStatus) )
332351 } else {
333352 authorizationPerformer. linkContinuation ( continuation)
334353 proxyDelegate. addPerformer ( authorizationPerformer)
335354 locationManager. requestAlwaysAuthorization ( )
336355 }
356+ #endif
337357 }
338358 } , onCancel: {
339359 proxyDelegate. cancel ( for: authorizationPerformer. uniqueIdentifier)
0 commit comments