问题
I am making an iOS Premium application, the routes that are loaded for the user have lots of waypoints, each turn is added as a waypoint to ensure the specific route is followed exactly as it was saved. This mucks up the voice guidance, rather than announcing the next turn the guidance announces "After ... you will reach your stopover" I would prefer it to say "After ... turn left" like normal, as if there were no waypoints. Is this possible? Where can I configure the voice guidance?
回答1:
You have few options.
FIRST:
Enables/disables voice prompts for certain maneuver.
@interface NMANavigationManager : NSObject
.....
- (BOOL)setVoiceEnabled:(BOOL)enabled forManeuverAction:(NMAManeuverAction)action
.....
NMAManeuver.h
/**
* Defines types of actions for a NMAManeuver.
*/
typedef NS_ENUM(NSInteger, NMAManeuverAction) {
/** An undefined action. */
NMAManeuverActionUndefined = 0, // 0
/** An indication there is no action associated with the maneuver. */
NMAManeuverActionNone, // 1
/** An action that indicates the end of a route. */
NMAManeuverActionEnd, // 2
/** An action that indicates a stopover. */
NMAManeuverActionStopover, // 3
/** An action that indicates a junction. */
NMAManeuverActionJunction, // 4
/** An action that indicates a roundabout. */
NMAManeuverActionRoundabout, // 5
/** An action that indicates a u-turn. */
NMAManeuverActionUTurn, // 6
/** An action that indicates entering a highway from the right. */
NMAManeuverActionEnterHighwayFromRight, // 7
/** An action that indicates entering a highway from the left. */
NMAManeuverActionEnterHighwayFromLeft, // 8
/** An action that indicates entering a highway. */
NMAManeuverActionEnterHighway, // 9
/** An action that indicates leaving a highway. */
NMAManeuverActionLeaveHighway, // 10
/** An action that indicates changing from one highway to another. */
NMAManeuverActionChangeHighway, // 11
/** An action that indicates continuing along a highway. */
NMAManeuverActionContinueHighway, // 12
/** An action that indicates boarding a ferry. */
NMAManeuverActionFerry, // 13
/** An action that indicates passing a junction. */
NMAManeuverActionPassJunction, // 14
/** An action that indicates heading after leaving public transit station. */
NMAManeuverActionHeadTo, // 15
/** An action that indicates passing a station. */
NMAManeuverActionPassStation, // 16
/** An action that indicates transit line change. */
NMAManeuverActionChangeLine, // 17
/** An invalid action. */
NMAManeuverActionInvalid = -1
};
SECOND: You may use delegate method. Just return NO and you won't hear any voice feedback.
@protocol NMANavigationManagerDelegate<NSObject>
@optional
......
-(BOOL)navigationManager:(NMANavigationManager *)navigationManager shouldPlayVoiceFeedbackWithText:(NSString *)text
.....
But in that case you would have to parse "feedback text" to understand whether you went to play a feedback.
回答2:
To fix this I added the parameter "&representation=navigation" to the getRoute call. I then each position (in the shape) to add each waypoint as an "NMAWaypointType.viaWaypoint" except for the first and last waypoint which are NMAWaypointType.stopWaypoint. Once doing this the correct route was represented and correct voice guidance played during the route.
来源:https://stackoverflow.com/questions/54762636/here-ios-sdk-premium-is-there-a-way-to-prevent-waypoints-stopovers-from-be