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: CLRegionand
didExitRegion region: CLRegionBut 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.