Ios 迪登特地区;在没有iBeacon的情况下实施地理围栏时,如果应用程序未运行,则不会调用该应用程序

Ios 迪登特地区;在没有iBeacon的情况下实施地理围栏时,如果应用程序未运行,则不会调用该应用程序,ios,swift,google-maps,cllocationmanager,geofencing,Ios,Swift,Google Maps,Cllocationmanager,Geofencing,我正在尝试在没有iBeacon的情况下实施地理围栏。这个 正在调用didStartMonitoringFor,但是 当应用程序未运行时,didEnterRegion&didenterestate未被调用 我正在调用didStartMonitoringFor中的requestState。因此,第一次调用了did。但在位置改变时不会被呼叫。有人能帮我吗 提前谢谢 感谢上帝!我自己得到了答案 我一直在主屏幕类中执行所有声明和委托方法实现。我将所有部分更改为AppDelegateclass。还对loca

我正在尝试在没有iBeacon的情况下实施地理围栏。这个 正在调用didStartMonitoringFor,但是 当应用程序未运行时,
didEnterRegion
&
didenterestate
未被调用

我正在调用
didStartMonitoringFor
中的
requestState
。因此,第一次调用了
did
。但在位置改变时不会被呼叫。有人能帮我吗


提前谢谢

感谢上帝!我自己得到了答案

我一直在主屏幕类中执行所有声明和委托方法实现。我将所有部分更改为
AppDelegate
class。还对location manager的属性进行了一些更改,如下所示:

    locationManager.delegate = self
    locationManager.activityType = .automotiveNavigation
    locationManager.desiredAccuracy = kCLLocationAccuracyNearestTenMeters
    locationManager.distanceFilter = 10.0
    locationManager.requestAlwaysAuthorization() 
还实现了两种委托方法

func locationManager(_ manager: CLLocationManager, didStartMonitoringFor region: CLRegion){
    manager.requestState(for: region)
}
func locationManager(_ manager: CLLocationManager, didDetermineState state: CLRegionState, for region: CLRegion) {
    if state == .inside
    {
            addNotification(region: region)
    }
}
func locationManager(_ manager: CLLocationManager, didEnterRegion region: CLRegion) {
            addNotification(region: region)
    }

成功了

请显示设置
CLLocationManager
Hello Karan的代码,我正在执行此代码并进行测试,但不起作用。请检查此代码。