Check location at app startup

How can I determine, when my app starts up, whether it is "home" or not? Home is a geofenced area defined by the user, and will typically be around their HomeKit home.


There's a great Geofencing tutorial at raywenderlich. I've adapted it into my project with very little effort and it works fine - my app responds perfectly to entering and leaving my geofenced areas.

didEnterRegion region: CLRegion

and

didExitRegion region: CLRegion


But when the app first starts, I need to know whether the user is within their home geofence ot not. The notifications from the system only trigger when you cross the boundaries of the geofence. The function

requestStateForRegion(_:)

sounds perfect but it does not work for custom regions such as the user's geofance.


I've added

locationManager.startUpdatingLocation()

to my AppDelegate and it works fine, but I need to find out if the locations it reports are within the Home geofence.

I solved it! My solution is over at stackoverflow, question 44204911.

"iOS Geofence How to handle when inside region when monitoring starts"

Check location at app startup
 
 
Q