Using XCode 9.4, I’m getting very strange and inconsistent results with the geofence project. I’ve created a very simple track, with a start waypoint, end waypoint, and then the start waypoint again, so that over three minutes the simulated location moves along a straight line, out and back.
I set the store location to be at one end of the line, so that halfway through the track the device location is the same as the store location. I set the fence to be three meters around the store, figuring that’s plenty for a walking speed.
I’ve set up NSLog statements all over the code so that I can see what events are being delivered, and print out some computed state along the way. Now, to the weird bit:
For some runs, the location manager delegate receives a notification that the device has entered the monitored region. On most runs, however, the didEnterRegion method never gets called. Even when this method does get called, the region claims that the device location is not within the region.
The didExitRegion method has not ever been called.
Fetching the store region from the location manager’s list of monitored regions and then asking that region if it contains the current coordinate returns true only when the current location is equal to the store location.
I would really love some help figuring out what I’m doing wrong. Can anyone give me a hand?