CoreLocation kCLErrorDomain error 5

前端 未结 7 1672
眼角桃花
眼角桃花 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: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.

提交回复
热议问题