I am using CLLocationManager object to start beacon ranging as per below code. Also enable the Background mode from Target -> Capabilities.
CLLocationManager *locationManager = [[CLLocationManager alloc] init];
locationManager.delegate = self;
locationManager.desiredAccuracy=kCLLocationAccuracyBest;
locationManager.distanceFilter=kCLDistanceFilterNone;
locationManager.pausesLocationUpdatesAutomatically = NO;
[locationManager requestAlwaysAuthorization];
Also add the AllowsBackgroundLocatoinUpdates to YES
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 9) {
locationManager.allowsBackgroundLocationUpdates = YES;
}
A Boolean value indicating whether the app wants to receive location updates when suspended.
Created on CLBeaconRegion object to range beacon like as
CLBeaconRegion *beacon_Region;
beacon_Region = [[CLBeaconRegion alloc] initWithProximityUUID:uuid major:mjorVa minor:minorVa identifier:tmpStrIdentifier];
beacon_Region.notifyEntryStateOnDisplay = YES;
beacon_Region.notifyOnEntry=YES;
beacon_Region.notifyOnExit=YES;
[locationManager startRangingBeaconsInRegion:beacon_Region];
It's ranging in Background mode in some period of time like 10 minutes or some time 20 minutes but not in infinite.