Strange problems with ranging a beacon region while monitoring the same beacon region in the same time on iPhone 5S

Hello, we are experiencing some strange problems with ranging and monitoring the same beacon region in the same time on iPhone 5S. These problems are not experienced on an iPhone XR so we suspect that it could be some kind of iOS issue on iPhone 5S.



iOS: 12.4.1

Device: iPhone 5S

Xcode: 10.3

Deployment target set to: 12.4

Code: Objective C



Description / steps of the problem:


- In a really simple test application we start monitoring and ranging a beacon region (with 2 beacons in proximity) in the same time (code snippet attached below)

- We are logging the beacons found by the ranging process

- The app shows that 2 beacons are detected

- Move the app in background, wait a little bit, and bring it into foreground again

- The app will show only one beacon (the other one is lost)



Notes:


- When our test app detects only 1 beacon instead of 2 beacons, then any other apps on that iPhone 5S that uses ranging will detect just one beacon (this is why we suspect that it should be an iOS issue)

- If that beacon region contains only 1 beacon then I can reproduce that issue only if I stop and restart the beacon in the proximity of the iPhone (the ranging process will not see it again). With 2 or more beacons it is reproducible even if the app is moved to background and brought into foreground again as noted above.

- Sometimes if I close the screen of the iPhone and re-open it then the lost beacon will re-appear for a moment but it will disappear again

- If 'startMonitoringForRegion' is commented out in the code then everything works fine

- The above issues are not reproducible on an iPhone XR



Did somebody experienced the above issues and have a good workaround for them? Thank you very much in advance.


----------------


#import "ViewController.h"

#import <CoreLocation/CoreLocation.h>


@interface ViewController () <CLLocationManagerDelegate>


@property (nonatomic, strong) CLLocationManager *locationManager;


@end


@implementation ViewController


- (void)viewDidLoad {

[super viewDidLoad];

self.locationManager = [[CLLocationManager alloc] init];

self.locationManager.delegate = self;

self.locationManager.allowsBackgroundLocationUpdates = YES;

self.locationManager.pausesLocationUpdatesAutomatically = NO;

[self.locationManager requestAlwaysAuthorization];

CLBeaconRegion *region = [[CLBeaconRegion alloc] initWithProximityUUID:[[NSUUID alloc] initWithUUIDString:@"C336AA38-54BB-483B-AE75-3BA707855035"] identifier:@"test"];

[self.locationManager startMonitoringForRegion:region];

[self.locationManager startRangingBeaconsInRegion:region];

}


- (void)locationManager:(CLLocationManager *)manager didEnterRegion:(CLRegion *)region {

}


- (void)locationManager:(CLLocationManager *)manager didExitRegion:(CLRegion *)region {

}


- (void)locationManager:(CLLocationManager *)manager didDetermineState:(CLRegionState)state forRegion:(CLRegion *)region {

}


- (void)locationManager:(CLLocationManager *)manager didRangeBeacons:(NSArray<CLBeacon *> *)beacons inRegion:(CLBeaconRegion *)region {

NSLog(@"%@",beacons);

}


@end

Replies

> 'startMonitoringForRegion'


While they do interact, 'region monitoring' and 'beacon detect' are not the same thing.


I think since beacon detect works as expected when region monitoring is off/commented out, your question is about the latter, and since region monitoring is decidedly organic in comparison, it may also be working as expected on the 5S.


My advice is to burn a support ticket w/DTS via the Member Center and ask them to take a look, being sure to have a project you can share that duplicates your trials, etc.