Skip to content

Commit 798128b

Browse files
committed
Fix #293
1 parent 6d02779 commit 798128b

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

ios/Permissions/RNPLocation.m

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ @implementation RNPLocation
1919

2020
+ (NSString *)getStatusForType:(NSString *)type
2121
{
22+
if (![CLLocationManager locationServicesEnabled]) {
23+
return RNPStatusRestricted;
24+
}
25+
2226
int status = [CLLocationManager authorizationStatus];
2327
switch (status) {
2428
case kCLAuthorizationStatusAuthorizedAlways:
@@ -36,6 +40,10 @@ + (NSString *)getStatusForType:(NSString *)type
3640

3741
- (void)request:(NSString*)type completionHandler:(void (^)(NSString *))completionHandler
3842
{
43+
if (![CLLocationManager locationServicesEnabled]) {
44+
return completionHandler(RNPStatusRestricted);
45+
}
46+
3947
NSString *status = [RNPLocation getStatusForType:nil];
4048
if (status == RNPStatusUndetermined) {
4149
self.completionHandler = completionHandler;

0 commit comments

Comments
 (0)