浏览代码

ignore the first call for didChangeAuthorization

Radu Popovici 7 年前
父节点
当前提交
98eb47556b
共有 1 个文件被更改,包括 9 次插入11 次删除
  1. 9
    11
      permissions/RNPLocation.m

+ 9
- 11
permissions/RNPLocation.m 查看文件

@@ -37,18 +37,16 @@
37 37
 {
38 38
     NSString *status = [RNPLocation getStatus];
39 39
     if (status == RNPStatusUndetermined) {
40
-        dispatch_async(dispatch_get_main_queue(), ^(){
41
-            self.completionHandler = completionHandler;
40
+        self.completionHandler = completionHandler;
41
+        
42
+        self.locationManager = [[CLLocationManager alloc] init];
43
+        self.locationManager.delegate = self;
42 44
             
43
-            self.locationManager = [[CLLocationManager alloc] init];
44
-            self.locationManager.delegate = self;
45
-                
46
-            if ([type isEqualToString:@"always"]) {
47
-                [self.locationManager requestAlwaysAuthorization];
48
-            } else {
49
-                [self.locationManager requestWhenInUseAuthorization];
50
-            }
51
-        });
45
+        if ([type isEqualToString:@"always"]) {
46
+            [self.locationManager requestAlwaysAuthorization];
47
+        } else {
48
+            [self.locationManager requestWhenInUseAuthorization];
49
+        }
52 50
     } else {
53 51
         completionHandler(status);
54 52
     }