CLBeaconRegion not monitored with StartMonitoringForRegion in simulator with XCTest

92 Views Asked by At

In my XCTest case, I'm calling StartMonitoringForRegion on a CLBeaconRegion with my CLLocationManager instance and it doesn't appear in my monitoredRegion property. It only happens in the simulator. Is the a bug or I'm doing something wrong?

1

There are 1 best solutions below

2
On

The simulator can't monitor for beacons, so this will always fail. If you want to test region monitoring with beacons you need to use a device. This doesn't have anything to do with XCText, its just that the simulator cant monitor for beacons. I believe you can still monitor for regions though because the simulator and simulate a location, it just can't simulate detecting a beacon.