信标调用了 didRange 但没有调用 didEnter?
Beacons didRange called but didEnter is not?
当信标关闭时,我总是didRange
被触发,而didEnter
不甚至被触发当我打开信标时。 (在信息上设置所有键)
设置信标:
if (CLLocationManager.authorizationStatus() != CLAuthorizationStatus.AuthorizedWhenInUse) {
locationManager.requestWhenInUseAuthorization()
}
let region = CLBeaconRegion(proximityUUID: NSUUID(UUIDString: "74278BDA-B644-4520-8F0C-720EAF059935")!, identifier: "Me")
region.notifyOnEntry=true;
region.notifyOnExit=true;
locationManager.startRangingBeaconsInRegion(region)
locationManager.delegate = self;
locationManager.requestAlwaysAuthorization()
locationManager.requestStateForRegion(region)
参会代表:
func locationManager(manager: CLLocationManager, didRangeBeacons beacons: [CLBeacon], inRegion region: CLBeaconRegion) {
print("didRangeBeacons"); // keep being called always
func locationManager(manager: CLLocationManager, didEnterRegion region: CLRegion) {
print("enter region"); // never happen
我想让它们都被调用,所以我可以检查 didRange
中的 值 ,但我也只能在 EnterRegion
很明显:)
locationManager.startRangingBeaconsInRegion(region)
仅开始测距,到监控 你需要:
locationManager.startMonitoringForRegion(region)
当信标关闭时,我总是didRange
被触发,而didEnter
不甚至被触发当我打开信标时。 (在信息上设置所有键)
设置信标:
if (CLLocationManager.authorizationStatus() != CLAuthorizationStatus.AuthorizedWhenInUse) {
locationManager.requestWhenInUseAuthorization()
}
let region = CLBeaconRegion(proximityUUID: NSUUID(UUIDString: "74278BDA-B644-4520-8F0C-720EAF059935")!, identifier: "Me")
region.notifyOnEntry=true;
region.notifyOnExit=true;
locationManager.startRangingBeaconsInRegion(region)
locationManager.delegate = self;
locationManager.requestAlwaysAuthorization()
locationManager.requestStateForRegion(region)
参会代表:
func locationManager(manager: CLLocationManager, didRangeBeacons beacons: [CLBeacon], inRegion region: CLBeaconRegion) {
print("didRangeBeacons"); // keep being called always
func locationManager(manager: CLLocationManager, didEnterRegion region: CLRegion) {
print("enter region"); // never happen
我想让它们都被调用,所以我可以检查 didRange
中的 值 ,但我也只能在 EnterRegion
很明显:)
locationManager.startRangingBeaconsInRegion(region)
仅开始测距,到监控 你需要:
locationManager.startMonitoringForRegion(region)