Kodeco Forums

Video Tutorial: MapKit and Core Location Part 4: Region Monitoring

Learn the basics of monitoring regions to create custom events when users enter or leave a defined space.


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/3356-mapkit-and-core-location/lessons/5

Thanks for the tutorials,
The Challenge didn’t work for me, rather than .requestWhenInUseAuthorization() I had to use .requestAlwaysAuthorization(). That somehow did the trick.
Also previously there were errors thrown kCLErrorDomain error 0. This is easy fix, go to Products/Schemes/Options and where the Allow Location Simulated is selected specify default Location, it shouldn’t be empty.

And last remark, also in the Challenge, your implementation of method didUpdateLocations is strange, cuz you are always updating the distance between OddPlace and the startLocation ignoring the locations: [CLLocation] being passed in, so the distance is always the same.

I just did the Video Tutorial, and I found that there is a new key for the info plist you need. This is “Privacy - Location Always and When In Use Usage Description”. You can notice that now seems like you have both key in one. With out this, the monitoring is not possible when you want to track always.

Is any chance to fires didExitRegion without firing didEnterRegion?

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

It’s been awhile since I worked with this. I think there may be cases where this does happen, but you should probably do some tests to confirm.