【发布时间】:2017-02-01 05:05:51
【问题描述】:
我目前正在使用 GeoFencing,我能够在 Apple 提供的 CoreLocation 框架的帮助下创建 GeoFence。但是当应用程序启动时,我无法创建超过 20 个栅栏。这是我的代码
提前致谢
func createGeofence() {
if CLLocationManager.isMonitoringAvailable(for: CLCircularRegion.self) {
// region data
let title = "Verity's"
let coordinate = CLLocationCoordinate2DMake(17.4220382049842 , 78.3794177044913)
let regionRadius = 150.0
// setup region
let region = CLCircularRegion(center:CLLocationCoordinate2D(latitude: coordinate.latitude, longitude: coordinate.longitude), radius: regionRadius, identifier: title)
//Added monitoring
locationManager.startMonitoring(for: region)
}
else {
}
func locationManager(_ manager: CLLocationManager, didEnterRegion region: CLRegion) {
self.enterRegion = region
}
func locationManager(_ manager: CLLocationManager, didExitRegionregion: CLRegion) {
}
【问题讨论】:
-
您能解释更多细节以提供帮助吗?
-
当然 prakash,我正在为这个位置创建地理围栏,让坐标 = CLLocationCoordinate2DMake(17.4220382049842 , 78.3794177044913) 有 100 个半径,但我需要创建多个地理围栏。希望能让你明白
-
您可以为一个应用创建 20 个 goefences。因此可以检查当前正在跟踪多少地理围栏。如果超过 20,则将无法正常工作。创建多个 goefences 时遇到什么错误。
-
我无法创建。我的意思是我不知道如何创建
-
嘿@BoosaRamesh,请参考我的答案,我已经修复并且它对我来说工作正常。
标签: ios swift3 mkmapview cllocationmanager geofencing