ios - 如何知道用户来到 iOS 中的特定位置?[既不是在背景中也不是在前景中]
问题描述
我有用户的当前位置。而且我可以匹配用户是否在循环内的半径。
我在应用程序的前景和背景中做过。但我想在终止的应用程序中做。当用户靠近我的特定点时,一旦进入我的区域,如何弹出警报?!!?
解决方案
对于应用程序的背景或终止状态
/*
* startMonitoringSignificantLocationChanges
*
* Discussion:
* Start monitoring significant location changes. The behavior of this service is not affected by the desiredAccuracy
* or distanceFilter properties. Locations will be delivered through the same delegate callback as the standard
* location service.
*
*/
@available(iOS 4.0, *)
open func startMonitoringSignificantLocationChanges()
使用 CLRegion 进行地理围栏- 跟踪天气用户进入该区域并离开该区域
let region = CLCircularRegion(center: geotification.coordinate, radius: geotification.radius, identifier: geotification.identifier)
region.notifyOnEntry = (geotification.eventType == .onEntry)
region.notifyOnExit = !region.notifyOnEntry
推荐阅读
- bash - Visual Studio 2019 git pre-commit hook 忽略 perl 命令
- javascript - 如何将 HTML 元素添加到字符串并即时为我的组件创建元素?
- python-3.x - 算法缩进错误的QGIS python脚本
- c# - 鼠标悬停控制并显示其句柄
- asp.net - 防止作为其他会话值列表的会话重写
- android - 互联网连接不可用时如何调用警报框?
- asp.net - 用户点击链接时如何显示文本框?
- javascript - 我可以使用 CSS 替换我的 SVG viewBox 属性吗?
- hive - 外部兽人和克劳德拉的蜂巢的兼容性问题
- php - PHP date() 增加一个小时返回值