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
13 changes: 10 additions & 3 deletions ios/RNReactNativeLocationSwitch.m
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,19 @@ - (dispatch_queue_t)methodQueue
CLAuthorizationStatus status = [CLLocationManager authorizationStatus];

if (![CLLocationManager locationServicesEnabled]) {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"App-Prefs:root=Privacy&path=LOCATION"] options:@{}
/*
using "App-Prefs:root=Privacy&path=LOCATION" results in app store rejection under
Guideline 2.5.1 - Performance - Software Requirements
The use of non-public APIs is not permitted on the App Store
because it can lead to a poor user experience should these APIs change.
*/
// show location settings
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString] options:@{}
completionHandler:^(BOOL success) {}];

} else if (status == kCLAuthorizationStatusDenied) {
NSLog(@"Location Services Disabled");

// show location settings
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString] options:@{}
completionHandler:^(BOOL success) {}];
Expand All @@ -42,7 +49,7 @@ - (dispatch_queue_t)methodQueue
onLocationDisable:(RCTResponseSenderBlock)errorCallback)
{
CLAuthorizationStatus status = [CLLocationManager authorizationStatus];

if (![CLLocationManager locationServicesEnabled] || status == kCLAuthorizationStatusDenied) {
NSLog(@"Location Services Disabled");
errorCallback(@[[NSNull null]]);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-location-switch",
"version": "0.1.0",
"version": "0.1.1",
"author": "Philipp Weitz",
"private": false,
"license": "Apache-2.0",
Expand Down