swift - EXC_BAD_ACCESS al llamar a startNavigationWithSettings(navSettings)
skmaps (1)
Configuré un ejemplo usando el fragmento de eventos de navegación Handling navigation de Skobbler. Cuando llamo
SKRoutingService.sharedInstance().startNavigationWithSettings(navSettings)
Obtengo EXC_BAD_ACCESS
. Aquí está el código:
override func viewDidLoad() {
super.viewDidLoad()
let mapView = SKMapView(frame: CGRectMake( 0.0, 0.0, CGRectGetWidth(self.view.frame), CGRectGetHeight(self.view.frame)))
mapView.delegate = self
self.view.addSubview(mapView)
SKRoutingService.sharedInstance().routingDelegate = self
SKRoutingService.sharedInstance().navigationDelegate = self
SKRoutingService.sharedInstance().mapView = mapView
var route = SKRouteSettings()
route.startCoordinate = CLLocationCoordinate2DMake(37.9667, 23.7167)
route.destinationCoordinate = CLLocationCoordinate2DMake(37.9677, 23.7567)
route.shouldBeRendered = true
route.numberOfRoutes = 1
SKRoutingService.sharedInstance().calculateRoute(route)
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
func routingService(routingService: SKRoutingService!, didFinishRouteCalculationWithInfo routeInformation: SKRouteInformation!) {
routingService.zoomToRouteWithInsets(UIEdgeInsetsZero)
var navSettings = SKNavigationSettings()
navSettings.navigationType = SKNavigationType.Simulation
navSettings.distanceFormat = SKDistanceFormat.Metric
SKRoutingService.sharedInstance().mapView.settings.displayMode = SKMapDisplayMode.Mode3D
SKRoutingService.sharedInstance().startNavigationWithSettings(navSettings)
}
El problema es que la propiedad audioAdvisorSettings de SKRoutingService no está configurada.
SKAdvisorSettings = SKAdvisorSettings()
settings.advisorVoice = "en_us";
SKRoutingService.sharedInstance().advisorConfigurationSettings = settings