CoreLocation Geofence not working as intended, only displays previous geofence and past identifier. Not updating

40 views Asked by At

I am trying to add a second region. That Region2 wasn't appearing so while I was debugging I deleted everything I had from Region2, and put Region2's coordinates into what I had for Region1 (which was working as intended). But the geofence never moved locations (they are across the city, no overlap, their radius was only 100m). When I moved my location in the simulator, even though I had set the Region1 geofence across the city, the simulator would still say "Entered: This Place" at the ORIGINAL geofence I created.

So I continued debugging - when I change the identifier of Region1 to "TEST TEST" it still prints out "This Place", even though I don't have "This Place" in any of my other files. Has this happened to anyone before? If so, how did you fix it?

let geoFenceRegion = CLCircularRegion(
center: CLLocationCoordinate2DMake(latitudeOfRegion, 
longitudeOfRegion),
radius: 100,
identifier: "This Place")
geoFenceRegion.notifyOnEntry = true
geoFenceRegion.notifyOnExit = false
manager.startMonitoring(for: geoFenceRegion)

I use the locationManager function didExit/didEnterRegion and I print out "Entered: (region.identifer)" or "Exited: (region.identifier)" just to test if I'm entering or exiting the region.

Edit: I tried commenting out this whole block of code and even when I do that, the simulator still says "Entered: This Place". I am not calling it from anywhere else in the code.

0

There are 0 answers