0

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?

iamarnold
  • 705
  • 1
  • 8
  • 22

1 Answers1

0

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.

arc4randall
  • 3,275
  • 3
  • 27
  • 40
  • I added the monitoringDidFailForRegion method but it didn't get called at all. It seems like startMonitoringForRegion doesn't work at all. Weird thing is it works if I add a CLCircularRegion instead of a CLBeaconRegion, it shows up in my monitoredRegion property. Is this normal? – iamarnold Mar 15 '16 at 22:34
  • Sorry that was incorrect. I updated my answer. MonitoringDidFail is only called when you attempt to monitor for more than 20 regions. My mistake, but the real reason is because you cant monitor for beacons with the simulator – arc4randall Mar 15 '16 at 22:37