Kodeco Forums

Geofencing with Core Location: Getting Started

In this geofencing tutorial, you’ll learn how to create and use geofences in iOS with Swift using the Region Monitoring API from Core Location.

This is a companion discussion topic for the original entry at https://www.raywenderlich.com/5470-geofencing-with-core-location-getting-started

I ran the finished project with SimulatedLocations. I found that the blue dot (location indicator) never reaches Apple. I “turned around” at about 5/6 on my way from Google to Apple.
I tried to change the 5 second difference to 15 on the GPX file but it only slowed me down on my way from Apple to Google, not the other way. How come I am in such a loop while the GPX file says I am on my one way travel from Apple to Google?

Awesome tutorial! Super informative! I only have one question… if the device reboots how do you add the geofences to the system again. The Apple docs say that they get removed when the device restarts. Thanks!

@macandyp Can you please help with this when you get a chance? Thank you - much appreciated! :]

I believe this is just an idiosyncrasy with simulated locations. If you remove one of the two locations, the location indicator will sit at the proper place. It has more to do with the fact that it’s trying to go so quickly between two locations (even at 15 seconds, traveling between those locations is still rather fast).

I’m not 100% sure on this. While I do see that comment in the documentation, I don’t see anything further about it. I believe it would still work, but may take a few minutes after a reboot. I’ll continue to look through any documentation about it just in case it’s just not standing out to me.

This tutorial is more than six months old so questions are no longer supported at the moment for it. Thank you!