【问题标题】:EXC_BAD_ACCESS when calling startNavigationWithSettings(navSettings)调用 startNavigationWithSettings(navSettings) 时的 EXC_BAD_ACCESS
【发布时间】:2015-03-04 16:33:51
【问题描述】:

我使用 Skobbler 的处理导航事件 sn-p 设置了一个示例。当我打电话时

SKRoutingService.sharedInstance().startNavigationWithSettings(navSettings)

我收到EXC_BAD_ACCESS。 代码如下:

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)
    }

【问题讨论】:

  • 这是最新的 2.4 SDK 还是之前的 2.3?
  • 开发者正在调查它——我们这些天会给出答案

标签: swift navigation skmaps


【解决方案1】:

问题是没有配置 SKRoutingService 的 audioAdvisorSettings 属性。

    SKAdvisorSettings = SKAdvisorSettings() 
    settings.advisorVoice = "en_us"; 
    SKRoutingService.sharedInstance().advisorConfigurationSettings = settings

【讨论】:

  • 我的理解是音频服务是用户可能根本不使用的附加选项,并且可能不会在他的资源中包含 SKAdvisorResources 包。在这种情况下,为什么要设置 SKAdvisorSettings?为了最大限度地简化情况,我特意尝试将示例设置得尽可能简单。
  • 这是正确的 - 这不应该是必需的 - 在下一次更新中我们将修复此行为,但暂时您需要配置音频建议(您不需要使用/添加音频建议文件 - 只需设置基本设置)
  • 感谢您的澄清。我会按照你的建议更改我的代码。
猜你喜欢
  • 2017-04-03
  • 2011-02-25
  • 1970-01-01
  • 1970-01-01
  • 2011-03-20
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多