Browse Source

ignore the first call for didChangeAuthorization

Radu Popovici 8 years ago
parent
commit
98eb47556b
1 changed files with 9 additions and 11 deletions
  1. 9
    11
      permissions/RNPLocation.m

+ 9
- 11
permissions/RNPLocation.m View File

37
 {
37
 {
38
     NSString *status = [RNPLocation getStatus];
38
     NSString *status = [RNPLocation getStatus];
39
     if (status == RNPStatusUndetermined) {
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
     } else {
50
     } else {
53
         completionHandler(status);
51
         completionHandler(status);
54
     }
52
     }