Error Domain=kCLErrorDomain Code=2 “The operation couldn’t be completed. (kCLErrorDomain error 2.)”

后端 未结 2 2001
情歌与酒
情歌与酒 2020-12-19 09:51
import UIKit
import CoreLocation

class ViewController: UIViewController, CLLocationManagerDelegate {

    @IBOutlet var latLabel: UILabel!
    @IBOutlet var longLab         


        
2条回答
  •  一生所求
    2020-12-19 10:31

    That's a network error, CLGeocoder needs a working network connection in order to reverse geocode a location, according to the docs.

    Also, CLGeocoder will throttle geocoding requests, returning that same error if you exceed the request rate, this is also documented in the class reference.

提交回复
热议问题