Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions ios/RNCGeolocation.mm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
}
Expand Down Expand Up @@ -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
Expand All @@ -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"]) {
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion react-native-geolocation.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down