CLMonitor: No events received for a region added while app is running

Originator:indiekiduk
Number:rdar://FB13696956 Date Originated:2024-03-24
Status:Open Resolved:No
Product:iOS Product Version:17.4
Classification:Bug Reproducible:Always
 
I have been experimenting with the new CLMonitor and I noticed if I add a region while the app is running then I don't receive any enter/exit events. I googled the problem and found someone else with the same issue so thought I would report it in case you are not aware:

https://developer.apple.com/forums/thread/740723?login=true

To reproduce the problem download the following example:
https://developer.apple.com/documentation/corelocation/monitoring_location_changes_with_core_location

Unzip and open the project in Xcode 15.3 

Add default: Text("Default") at line 86 to fix the compilation bug.

Launch in Simulator iPhone 15 Pro 17.4 (or on real iPhone running 17.4)
Click the location triangle in the toolbar in bottom pane of Xcode and choose "Add GPX" and choose the ApplePark.gpx file I attached to this feedback report.

You'll say it says ApplePark Satisfied. Now click the X next to it. It'll say unknown. Now click "Add Circular..." button at bottom. It's stuck on ApplePark unknown. No matter if you use the location arrow in debug pane toolbar to change location from apple park to one of the others there is no way to make the status update.

Now to make it work again the app needs to be relaunched. Relaunch the app. Choose Apple Park using the Location array in debug pane, now it says satisfied.


Although this sample code is highly non-standard SwiftUI, I believe the bug is in CLMonitor itself. I hope it can be fixed!

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!