I would like to show user 3 different local notifications as he is coming to exact point. So I set 3 circular regions with same center but different radiuses (500m, 1km, 2km). When I am closing to this point I get all 3 notifications at once. Why is it happening? Did I do something wrong with my code below or is it just function from Apple that shows more region notifications to consume less battery? Can I do this some other way (alert user when he is closing to some point?
func createLocalNotification(id: String, title: String, body: String, center: CLLocationCoordinate2D, radius: CLLocationDistance, repeats: Bool) {
let notificationCenter = UNUserNotificationCenter.current()
let content = UNMutableNotificationContent()
content.title = title
content.body = body
content.sound = UNNotificationSound.default()
let region = CLCircularRegion(center: center, radius: radius, identifier: id)
region.notifyOnEntry = true
region.notifyOnExit = false
let trigger = UNLocationNotificationTrigger(region: region, repeats: repeats)
let request = UNNotificationRequest(identifier: id, content: content, trigger: trigger)
notificationCenter.add(request) { (error) in
if let error = error {
print("Uh oh! We had an error: \(error)")
}
}
}