瀏覽代碼

Check type (always or wheninuse) when requesting location permission. addresses #51

Yonah Forst 8 年之前
父節點
當前提交
bb8833c1bc
共有 1 個檔案被更改,包括 5 行新增1 行删除
  1. 5
    1
      permissions/RNPLocation.m

+ 5
- 1
permissions/RNPLocation.m 查看文件

@@ -50,7 +50,11 @@
50 50
             [self.locationManager requestWhenInUseAuthorization];
51 51
         }
52 52
     } else {
53
-        completionHandler(status);
53
+        if ([CLLocationManager authorizationStatus] == kCLAuthorizationStatusAuthorizedWhenInUse && [type isEqualToString:@"always"]) {
54
+            completionHandler(RNPStatusDenied);
55
+        } else {
56
+            completionHandler(status);
57
+        }
54 58
     }
55 59
 }
56 60