From 7ddcbc02e209bc538834d315046a07944016f4eb Mon Sep 17 00:00:00 2001 From: Vikram Biwal Date: Tue, 12 Feb 2019 17:36:10 +0530 Subject: [PATCH] Can not found RNPStatusRestricted in iOS When "location Services" off from device the we have to return the status "RNPStatusRestricted" but it returns "RNPStatusDenied". So I aded "location Services" check also for "RNPStatusRestricted". --- ios/Permissions/RNPLocation.m | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/ios/Permissions/RNPLocation.m b/ios/Permissions/RNPLocation.m index 64673650..107e8baf 100644 --- a/ios/Permissions/RNPLocation.m +++ b/ios/Permissions/RNPLocation.m @@ -17,20 +17,23 @@ @interface RNPLocation() @implementation RNPLocation -+ (NSString *)getStatusForType:(NSString *)type -{ - int status = [CLLocationManager authorizationStatus]; - switch (status) { - case kCLAuthorizationStatusAuthorizedAlways: ++ (NSString *)getStatusForType:(NSString *)type { + if ([CLLocationManager locationServicesEnabled]) { + int status = [CLLocationManager authorizationStatus]; + switch (status) { + case kCLAuthorizationStatusAuthorizedAlways: return RNPStatusAuthorized; - case kCLAuthorizationStatusAuthorizedWhenInUse: + case kCLAuthorizationStatusAuthorizedWhenInUse: return [type isEqualToString:@"always"] ? RNPStatusDenied : RNPStatusAuthorized; - case kCLAuthorizationStatusDenied: + case kCLAuthorizationStatusDenied: return RNPStatusDenied; - case kCLAuthorizationStatusRestricted: + case kCLAuthorizationStatusRestricted: return RNPStatusRestricted; - default: + default: return RNPStatusUndetermined; + } + }else{ + return RNPStatusRestricted; } }