Github user shazron commented on a diff in the pull request: https://github.com/apache/cordova-plugin-geolocation/pull/87#discussion_r113561945 --- Diff: src/ios/CDVLocation.m --- @@ -94,61 +94,62 @@ - (BOOL)isLocationServicesEnabled - (void)startLocation:(BOOL)enableHighAccuracy { - if (![self isLocationServicesEnabled]) { - [self returnLocationError:PERMISSIONDENIED withMessage:@"Location services are not enabled."]; - return; - } - if (![self isAuthorized]) { - NSString* message = nil; - BOOL authStatusAvailable = [CLLocationManager respondsToSelector:@selector(authorizationStatus)]; // iOS 4.2+ - if (authStatusAvailable) { - NSUInteger code = [CLLocationManager authorizationStatus]; - if (code == kCLAuthorizationStatusNotDetermined) { - // could return POSITION_UNAVAILABLE but need to coordinate with other platforms - message = @"User undecided on application's use of location services."; - } else if (code == kCLAuthorizationStatusRestricted) { - message = @"Application's use of location services is restricted."; + [self.commandDelegate runInBackground:^{ + if (![self isLocationServicesEnabled]) { --- End diff -- You have to be careful here -- you can't use self in the block, you have to grab a weak reference to self and use it in the block. Like so: https://github.com/apache/cordova-ios/blob/92a62997adb3c8512328d5a0ae42fe5d156291f1/CordovaLib/Classes/Private/Plugins/CDVHandleOpenURL/CDVHandleOpenURL.m#L58 Just us a general note -- I don't notice any of this in your code but it may occur in nested calls -- any calls to UIKit framework classes must occur in the main thread while called inside the block, so that may complicate things.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@cordova.apache.org For additional commands, e-mail: dev-h...@cordova.apache.org