Github user shazron commented on a diff in the pull request:
https://github.com/apache/cordova-plugin-geolocation/pull/87#discussion_r115553911
--- 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 --
It's a good practice (yes I read the article). In this case, self will
always be retained (it's the plugin, which is always retained until the app
closes).
---
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 [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]