自定义 bottomBanner 中未调用 NavigationServiceDelegate 方法
NavigationServiceDelegate methods are not being called in custom bottomBanner
我有一个符合 ContainerViewController
的自定义 bottomBanner
class
class TurnByTurnBottomBannerControllerV3: ContainerViewController {
func navigationService(_ service: NavigationService, didUpdate progress: RouteProgress, with location: CLLocation, rawLocation: CLLocation) {
print("[==] didUpdate progress")
}
}
但是 didUpdate
没有被调用。我检查过 didUpdate
应该从这部分代码调用:
public func navigationService(_ service: NavigationService, didUpdate progress: RouteProgress, with
location: CLLocation, rawLocation: CLLocation) {
//Check to see if we're in a tunnel.
checkTunnelState(at: location, along: progress)
//Pass the message onto our navigation components
for component in navigationComponents {
component.navigationService(service, didUpdate: progress, with: location, rawLocation:
rawLocation)
}
...
它是从那个循环中调用的(其中一个组件是 TurnByTurnBottomBannerControllerV3
),
(lldb) po navigationComponents
▿ 3 elements
▿ 0 : <MapboxNavigation.RouteMapViewController: 0x10b911a00>
▿ 1 : <MapboxNavigation.TopBannerViewController: 0x10b879e00>
- 2 : <ProjectName.TurnByTurnBottomBannerControllerV3: 0x122e54170>
但出于某种原因,我没有收到委托实现中的调用。不知道我做错了什么。有什么建议吗?
Mapbox Navigation SDK 有一个包含 public 示例的 repo,one of them 专门关于使用您自己的顶部和底部横幅。请查看该解决方案是否适合您。
原来我有一个名为 NavigationService
的 class 而 Xcode 只是没有以任何方式通知我它与图书馆冲突。
我有一个符合 ContainerViewController
bottomBanner
class
class TurnByTurnBottomBannerControllerV3: ContainerViewController {
func navigationService(_ service: NavigationService, didUpdate progress: RouteProgress, with location: CLLocation, rawLocation: CLLocation) {
print("[==] didUpdate progress")
}
}
但是 didUpdate
没有被调用。我检查过 didUpdate
应该从这部分代码调用:
public func navigationService(_ service: NavigationService, didUpdate progress: RouteProgress, with
location: CLLocation, rawLocation: CLLocation) {
//Check to see if we're in a tunnel.
checkTunnelState(at: location, along: progress)
//Pass the message onto our navigation components
for component in navigationComponents {
component.navigationService(service, didUpdate: progress, with: location, rawLocation:
rawLocation)
}
...
它是从那个循环中调用的(其中一个组件是 TurnByTurnBottomBannerControllerV3
),
(lldb) po navigationComponents
▿ 3 elements
▿ 0 : <MapboxNavigation.RouteMapViewController: 0x10b911a00>
▿ 1 : <MapboxNavigation.TopBannerViewController: 0x10b879e00>
- 2 : <ProjectName.TurnByTurnBottomBannerControllerV3: 0x122e54170>
但出于某种原因,我没有收到委托实现中的调用。不知道我做错了什么。有什么建议吗?
Mapbox Navigation SDK 有一个包含 public 示例的 repo,one of them 专门关于使用您自己的顶部和底部横幅。请查看该解决方案是否适合您。
原来我有一个名为 NavigationService
的 class 而 Xcode 只是没有以任何方式通知我它与图书馆冲突。