MapKit ve CoreLocation kullanarak bir iOS uygulaması yapıyorum. Ben arayarak kullanıcının mevcut konumunu elde edebilirsiniz:Kullanıcının gerçekte ne zaman hareket ettiğini kontrol edin
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
self.setupUI()
locationManager.delegate = self
locationManager.desiredAccuracy = kCLLocationAccuracyBest
self.mapView.delegate = self
self.locationManager.startUpdatingLocation()
self.mapView.showsUserLocation = true
geoCoder = CLGeocoder()
}
func locationManager(manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
let location: CLLocation = locations.last!
// self.addressView.text = "\(location.coordinate.latitude) \(location.coordinate.longitude)"
geoCode(location)
if (zoomed == false) {
zoomToUserLocationAnimated(true)
zoomed = true
}
}
Ama kullanıcı hareket etmez bile bu işlev denir. OSX'de iOS simulatörü kullanıyorum ve bir lokasyonu simüle ettim, bu yüzden simülatörün hareket etmediğinden gayet eminim, fakat yine de bu fonksiyon deniliyor, kullanıcının yapılıp yapılmadığını kontrol etmenin bir yolu olup olmadığını bilmek istiyorum gerçek bir hareket?
Teşekkür
Konum Yöneticisi Hizmetini nasıl başlatıyorsunuz? – Abizern
benim düzenlemelerimi görün :) –
[startMonitoringSignificantLocationChanges()] 'ı kullanmayı deneyin (https://developer.apple.com/library/ios/documentation/CoreLocation/Reference/CLLocationManager_Class/#//apple_ref/occ/instm/CLLocationManager/startMonitoringSignificantLocationChanges) startUpdatingLocation() ' – Abizern