【问题标题】:Implementing Voice navigation in HERE maps在 HERE 地图中实现语音导航
【发布时间】:2018-04-20 08:39:33
【问题描述】:

我正在使用 HERE 地图在 iOS (Objective-C) 中构建一个基于地图的应用程序,对此我很陌生。我在实施导航方面取得了成功,但在实施导航语音指令方面遇到了困难。这是我的代码:

- (void) beginNavigationMethod {
    self.mapView.zoomLevel = 17.0;
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didUpdatePositionForNavigation) name:NMAPositioningManagerDidUpdatePositionNotification object:[NMAPositioningManager sharedPositioningManager]];

    NMAVoiceCatalog *voiceCatalog = [NMAVoiceCatalog sharedVoiceCatalog];
    voiceCatalog.delegate = self;
    [voiceCatalog updateVoiceCatalog];

    [self.navigationManager startTurnByTurnNavigationWithRoute:self.route];
    [NMANavigationManager sharedNavigationManager].mapTrackingEnabled = YES;
    [NMANavigationManager sharedNavigationManager].mapTrackingAutoZoomEnabled = YES;
    [NMANavigationManager sharedNavigationManager].mapTrackingOrientation
    = NMAMapTrackingOrientationDynamic;
    [NMANavigationManager sharedNavigationManager].speedWarningEnabled = YES;
    NSError* error = [[NMANavigationManager sharedNavigationManager] startTurnByTurnNavigationWithRoute:self.route];
    NSLog(@"%@",error);
}

- (void)voiceCatalog:(nonnull NMAVoiceCatalog *)voiceCatalog didUpdateWithError:(nullable NSError *)error {
    NSLog(@"didUpdateWithError: %@",error);
}

我基本上不知道该怎么做。我为如此幼稚而道歉。如果有人能指导我完成这个,那将是一个很大的帮助。

【问题讨论】:

    标签: ios objective-c here-api


    【解决方案1】:

    您可以查看文档:https://developer.here.com/documentation/ios-premium/topics/map-voice-instructions.html

    否则,Android 的示例在哪里:https://github.com/heremaps/here-android-sdk-examples/issues/36#issuecomment-304873154,如果你能通过它,它会给你一个如何做到这一点的印象。

    【讨论】:

    • 感谢您的链接,但我已经检查了第一个链接,请您帮我编写 Objective-C 中的代码。
    【解决方案2】:

    请试试这个代码

     [[NMANavigationManager sharedNavigationManager] setVoicePackageMeasurementSystem:NMAMeasurementSystemImperialUS];
     [[NMAAudioManager sharedAudioManager] setDelegate:self];
     [[NMAAudioManager sharedAudioManager]setManagesAudioSession:NO];
    

    这里映射委托方法

     - (BOOL)audioManager:(NMAAudioManager *)audioManager shouldPlayOutput:(NMAAudioOutput *)output{  
           return true;
       }
    

    项目设置->常规->功能->后台模式

    【讨论】:

    • 感谢您的帮助我不确定发生了什么,但我只是使用了他们演示项目中的代码,它开始工作了。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-07-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-03-07
    • 1970-01-01
    • 2018-01-07
    相关资源
    最近更新 更多