Mathieu Acthernoene hace 5 años
padre
commit
798128be90
Se han modificado 1 ficheros con 8 adiciones y 0 borrados
  1. 8
    0
      ios/Permissions/RNPLocation.m

+ 8
- 0
ios/Permissions/RNPLocation.m Ver fichero

19
 
19
 
20
 + (NSString *)getStatusForType:(NSString *)type
20
 + (NSString *)getStatusForType:(NSString *)type
21
 {
21
 {
22
+    if (![CLLocationManager locationServicesEnabled]) {
23
+        return RNPStatusRestricted;
24
+    }
25
+
22
     int status = [CLLocationManager authorizationStatus];
26
     int status = [CLLocationManager authorizationStatus];
23
     switch (status) {
27
     switch (status) {
24
         case kCLAuthorizationStatusAuthorizedAlways:
28
         case kCLAuthorizationStatusAuthorizedAlways:
36
 
40
 
37
 - (void)request:(NSString*)type completionHandler:(void (^)(NSString *))completionHandler
41
 - (void)request:(NSString*)type completionHandler:(void (^)(NSString *))completionHandler
38
 {
42
 {
43
+    if (![CLLocationManager locationServicesEnabled]) {
44
+        return completionHandler(RNPStatusRestricted);
45
+    }
46
+
39
     NSString *status = [RNPLocation getStatusForType:nil];
47
     NSString *status = [RNPLocation getStatusForType:nil];
40
     if (status == RNPStatusUndetermined) {
48
     if (status == RNPStatusUndetermined) {
41
         self.completionHandler = completionHandler;
49
         self.completionHandler = completionHandler;