Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conflict with geolocation geofences, plugin seems to assume existence of proximityUUID parameter #35

Open
skokhuis opened this issue Jul 4, 2016 · 3 comments

Comments

@skokhuis
Copy link

skokhuis commented Jul 4, 2016

Hi,

This plugin conflicts with https://github.com/transistorsoft/react-native-background-geolocation. The author of this geolocation plugin suggests this plugin is responding to “his” geofences, interrogating it for the proximityUUID key which doesn't exist.

Could this be resolved by checking for the existence of the proximityUUID parameter? I have too little C knowledge to fix it myself. Thanks! Also for this great plugin.

This is the result with both plugins in a project when a geofence is crossed:

2016-07-04 14:16:49.933 GeoFence[2772:401504] -[CLCircularRegion proximityUUID]: unrecognized selector sent to instance 0x1278f0800

2016-07-04 14:16:49.936 GeoFence[2772:401504] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[CLCircularRegion proximityUUID]: unrecognized selector sent to instance 0x1278f0800'

@skokhuis skokhuis changed the title Conflict with react-native-background-geolocation plugin, possibly because plugin assumes existence of proximityUUID parameter Conflict with geolocation geofences, plugin seems to assume existence of proximityUUID parameter Jul 4, 2016
@skokhuis
Copy link
Author

skokhuis commented Jul 4, 2016

Adding a check if the proximityUUID property exists seems to have fixed it. File RNBeacon.m, updated last part to:

-(void)locationManager:(CLLocationManager *)manager
        didEnterRegion:(CLBeaconRegion *)region {
    if (! [region respondsToSelector:@selector(proximityUUID)]) {
        return;
    }

    NSDictionary *event = @{
                            @"region": region.identifier,
                            @"uuid": [region.proximityUUID UUIDString],
                            };

    [self.bridge.eventDispatcher sendDeviceEventWithName:@"regionDidEnter" body:event];
}

-(void)locationManager:(CLLocationManager *)manager
         didExitRegion:(CLBeaconRegion *)region {
    if (! [region respondsToSelector:@selector(proximityUUID)]) {
        return;
    }
    NSDictionary *event = @{
                            @"region": region.identifier,
                            @"uuid": [region.proximityUUID UUIDString],
                            };

    [self.bridge.eventDispatcher sendDeviceEventWithName:@"regionDidExit" body:event];
}

ca057 pushed a commit to Artirigo/react-native-ibeacon that referenced this issue Mar 6, 2017
@ca057
Copy link

ca057 commented Mar 6, 2017

Thanks for pointing out the fix. I had a similar issue and implemented your solution in a fork which you can check out here. Does anyone know if there should be more checks added? Otherwise I would test it and eventually file a PR here in the base repo.

@plbrault
Copy link

Thank you @skokhuis and @ca057 for the fix. I had the exact same issue in my project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants