gpt4 book ai didi

swift - 信标调用了 didRange 但没有调用 didEnter?

转载 作者:可可西里 更新时间:2023-11-01 01:33:31 25 4
gpt4 key购买 nike

当信标关闭时,我总是触发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 中的 value,但我也只能在 上发送推送输入区域

最佳答案

显然 :)

    locationManager.startRangingBeaconsInRegion(region)

开始测距监控您需要:

     locationManager.startMonitoringForRegion(region)

关于swift - 信标调用了 didRange 但没有调用 didEnter?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38813938/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com