LocationManager didEnterRegion 未调用(再次)

LocationManager didEnterRegion not called (again)

我正在尝试注册区域,以便在用户输入时收到通知。这是我使用的代码:

public func locationManager(manager:CLLocationManager, didEnterRegion region:CLRegion){
    print("did enter region \(region)")
    let regionPalina=region.identifier;
    if regionPalina==palina{
        regionMonitoringCompletion?()
    }
}

public func locationManager(manager: CLLocationManager, monitoringDidFailForRegion region: CLRegion?, withError error: NSError){
        print(error.localizedDescription)
}

let myLocationManager=CLLocationManager()

func startMonitoringForRegion(completion:(Void->Void)){
    regionMonitoringCompletion=completion;
    myLocationManager.delegate=self
    if !monitoredForRegion{
        myLocationManager.startMonitoringForRegion(self.regionForPalina())
        monitoredForRegion=true
    }
}

public func locationManager(manager: CLLocationManager, didStartMonitoringForRegion region: CLRegion){
    print("region: \(region) registered")
    print(myLocationManager.monitoredRegions)
}

public func locationManager(manager: CLLocationManager, didDetermineState state: CLRegionState, forRegion region: CLRegion){
    print("state transition \(state)")
}

func stopMonitoringForRegion(){
    myLocationManager.delegate=nil
    regionMonitoringCompletion=nil
    if !monitoredForRegion {
        myLocationManager.stopMonitoringForRegion(self.regionForPalina())
        monitoredForRegion=false
    }
}

注册似乎很顺利,因为调用了 didStartMonitoringForRegion 并正确打印了受监控的区域。然而,didEnterRegion、didDetermineState 甚至 monitoringDidFailForRegion 都没有被调用。

可能是什么生意?

我最终用用户位置模拟了这些东西。