问题描述
我遇到一个问题,如果我在该区域内启动应用程序,则该应用程序将不会触发didEnterRegion事件。如果我在该区域之外启动该应用程序,然后进入该区域,则会触发。如果我在该区域内启动该应用程序,然后离开该区域,然后重新进入该区域,则会触发。
I'm having an issue where my app will not fire the didEnterRegion event if I start the app within the region. If I start the app outside the region and then enter the region, it fires. If I start the app inside the region, then leave the region, then re-enter the region, it fires.
有关如何使其尽快触发的任何建议
Any suggestions on how to get it to fire as soon as the app is opened if it's in the region would be much appreciated!
推荐答案
我认为您无法做到这一点。
I don't think you can do that.
但是,您可以获取当前位置并检查它是否在您指定的区域之内。 CLCircularRegion
为此具有 containsCoordinate:
方法。
But, you can get the current location and check if it's inside the region you're specifying yourself. CLCircularRegion
has a containsCoordinate:
method for this.
这篇关于如果应用程序在该区域内启动,则startMonitoringForRegion不会调用didEnterRegion的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!