Ho aggiunto CLLocationManager nella mia app utilizzando Swift nel file AppDelegate.startMonitoringSignificantLocationChanges non funziona in swift
Nel file Appdelegate.swift,
import CoreLocation
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate, CLLocationManagerDelegate {
var locationManager: CLLocationManager!
Nel metodo didbecomeActive:
func applicationDidBecomeActive(application: UIApplication) {
if((locationManager) != nil)
{
locationManager.stopMonitoringSignificantLocationChanges()
locationManager.delegate = nil
locationManager = nil
}
locationManager = CLLocationManager()
locationManager.delegate = self
locationManager.desiredAccuracy = kCLLocationAccuracyBest
locationManager.activityType = CLActivityType.OtherNavigation
locationManager.requestAlwaysAuthorization()
locationManager.startMonitoringSignificantLocationChanges()
}
Se uso startUpdatingLocation
, didUpdateLocations
metodo viene chiamato, ma non per startMonitoringSignificantLocationChanges
.
Perché non viene chiamato per startMonitoringSignificantLocationChanges
. Lo sto testando nel simulatore di ios. Non so come fare il check-in del dispositivo.
possibile duplicato di: http://stackoverflow.com/questions/8682683/can-i-test-significant-change-with-xcode-simulator – adolfosrs