CoreLocation kCLErrorDomain error 5

前端 未结 7 1663
眼角桃花
眼角桃花 2021-02-04 14:59

I subclassed a CLRegion to support Polygons via overriding containsCoordinate: to use ray casting logic instead of the original distance crunching logi

相关标签:
7条回答
  • 2021-02-04 15:16

    It is also possible to get this error code back when your latitude and longitude values don't make sense. (I'd transposed them, for example, and was vexed by this error for a while.)

    0 讨论(0)
  • 2021-02-04 15:17

    I hate to answer my own question, but I have found the solution to my issue. A kCLErrorDomain code/error of 5 denotes that you have tried to monitor more than 20 CLRegions. In my case, both subclasses were guilty of monitoring more than 20 regions.

    0 讨论(0)
  • 2021-02-04 15:20

    Also: if you're testing with iBeacons, you can't use the iOS simulator.

    0 讨论(0)
  • 2021-02-04 15:22

    If anybody is still struggling with this then take a look here:

    In my case, I had to call requestAlwaysAuthorization just before calling startMonitoring and it worked like charm!

    locationManager.requestAlwaysAuthorization()
    
    let currRegion = CLCircularRegion(center: CLLocationCoordinate2D(latitude: LAT, longitude: LONG, radius: 100, identifier: "MyLocation")
    currRegion.notifyOnEntry = true
    
    locationManager.startMonitoring(for: region)
    

    Btw, I would love to thank https://shrikar.com/swift-tutorial-corelocation-and-region-monitoring-in-ios-8/ for this.

    0 讨论(0)
  • 2021-02-04 15:38

    This error could also rise up if added CLRegion is nil.

    0 讨论(0)
  • 2021-02-04 15:38

    I got this error because i did not start the Bluetooth. So... do not forget to start your Bluetooth ;)

    0 讨论(0)
提交回复
热议问题