Github user jcesarmobile commented on a diff in the pull request:
https://github.com/apache/cordova-plugin-geolocation/pull/87#discussion_r113578907
--- 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 --
I think we are abusing of the weak references to self in the plugins. In
most cases it's not really needed because we don't retain the block
http://stackoverflow.com/questions/20030873/always-pass-weak-reference-of-self-into-block-in-arc
---
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]