It's very strange that didEnterRegion
and didExitRegion
are never fired after startMonitoringForRegion
is called. In addition, didDetermineState
could be triggered as expectation.
During the current stage, I only evaluate the iBeacon tech based on Apple's sample code demo, Airlocated.
Therefore, I only implement two methods, including didEnterRegion
and didExitRegion
in the file APLAppDelegate.m
as bellow:
- (void)locationManager:(CLLocationManager *)manager didEnterRegion:(CLRegion *)region
{
NSLog(@"Entered region: %@", region);
[self sendLocalNotificationForBeaconRegion:(CLBeaconRegion *)region];
}
- (void)locationManager:(CLLocationManager *)manager didExitRegion:(CLRegion *)region
{
NSLog(@"Exited region: %@", region);
}
Bellow steps have been tried, but no effect.
- in project info or info.plist --> Custom IOS Target Properties --> . add "Required background modes" . in this add two items --> ."App shares data using CoreBluetooth" ."App registers for location updates"
- in project Capability --> There is Background Modes
. check "Loaction update"
. check "Acts as a Bluetooth LE accessory" . check "uses bluetooth LE accessories"
So, could anyone give me some suggestion on it?
Thanks in advance.
Add startRangingBeaconsInRegion
method after startMonitoringForRegion
and try again
[_locationManager startRangingBeaconsInRegion:demoRegion];
// demoRegion - region you have created