Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在 cllocation 管理器中工作并获取用户的当前位置,但无法找到用户状态,例如用户处于运行位置或停止位置。所以请帮助我,当用户在 iphone 中以编程方式行走时,如何获得其正确状态。
使用 CLLocation 的速度属性,启用 GPS 并设置为最佳精度。
If (loc.speed > 7/3.6) then running
步行:< 6 公里/小时
停止更困难:没有位置更新(用计时器测量) 但是你无法区分“停止”和“没有 GPS 可用”(例如在地下或室内)。如果状态需要实时,那将需要加速度传感器。