diff --git a/ios/RNCGeolocation.mm b/ios/RNCGeolocation.mm index 03df64d..8be6577 100644 --- a/ios/RNCGeolocation.mm +++ b/ios/RNCGeolocation.mm @@ -190,7 +190,7 @@ - (void)beginLocationUpdatesWithDesiredAccuracy:(CLLocationAccuracy)desiredAccur if (@available(iOS 14.0, *)) { if ( -#if ! TARGET_OS_VISION +#if !TARGET_OS_VISION && !TARGET_OS_TV _lastUpdatedAuthorizationStatus == kCLAuthorizationStatusAuthorizedAlways || #endif _lastUpdatedAuthorizationStatus == kCLAuthorizationStatusAuthorizedWhenInUse @@ -204,22 +204,22 @@ - (void)beginLocationUpdatesWithDesiredAccuracy:(CLLocationAccuracy)desiredAccur - (void)startMonitoring { -#if !TARGET_OS_VISION +#if !TARGET_OS_VISION && !TARGET_OS_TV _usingSignificantChanges ? [_locationManager startMonitoringSignificantLocationChanges] : [_locationManager startUpdatingLocation]; -#else +#elif !TARGET_OS_TV [_locationManager startUpdatingLocation]; #endif } - (void)stopMonitoring { -#if !TARGET_OS_VISION +#if !TARGET_OS_VISION && !TARGET_OS_TV _usingSignificantChanges ? [_locationManager stopMonitoringSignificantLocationChanges] : [_locationManager stopUpdatingLocation]; -#else +#elif !TARGET_OS_TV [_locationManager stopUpdatingLocation]; #endif } @@ -283,7 +283,7 @@ - (void)timeout:(NSTimer *)timer // Request location access permission if (wantsAlways) { -#if !TARGET_OS_VISION +#if !TARGET_OS_VISION && !TARGET_OS_TV [_locationManager requestAlwaysAuthorization]; [self enableBackgroundLocationUpdates]; #endif @@ -294,7 +294,7 @@ - (void)timeout:(NSTimer *)timer - (void)enableBackgroundLocationUpdates { -#if !TARGET_OS_VISION +#if !TARGET_OS_VISION && !TARGET_OS_TV // iOS 9+ requires explicitly enabling background updates NSArray *backgroundModes = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"UIBackgroundModes"]; if (backgroundModes && [backgroundModes containsObject:@"location"]) { @@ -473,7 +473,7 @@ - (void)locationManagerDidChangeAuthorization:(CLLocationManager *)manager } if ( -#if !TARGET_OS_VISION +#if !TARGET_OS_VISION && !TARGET_OS_TV currentStatus == kCLAuthorizationStatusAuthorizedAlways || #endif currentStatus == kCLAuthorizationStatusAuthorizedWhenInUse diff --git a/react-native-geolocation.podspec b/react-native-geolocation.podspec index df45e6d..32da249 100644 --- a/react-native-geolocation.podspec +++ b/react-native-geolocation.podspec @@ -10,7 +10,7 @@ Pod::Spec.new do |s| s.authors = package['author'] s.homepage = package['homepage'] - s.platforms = { :ios => '9.0', :visionos => '1.0' } + s.platforms = { :ios => '9.0', :tvos => '9.0', :visionos => '1.0' } s.source = { :git => "https://github.com/react-native-community/react-native-geolocation.git", :tag => "v#{s.version}" } s.source_files = "ios/**/*.{h,m,mm}"