Search code examples
iosswiftskmaps

Changing advice language doesn't work


I'm new with Skobbler SDK and learn with the Swift Demo + the well documented tuto (http://developer.skobbler.com/getting-started/ios#sec01)

However, I still can't configure the advice language settings using their instructions ...

Here is my code :

let settings = SKAdvisorSettings()
    settings.advisorVoice =  "fr"
    settings.language  = SKAdvisorLanguage.FR
    settings.advisorType = SKAdvisorType.AudioFiles
    settings.resourcesPath = NSBundle.mainBundle().resourcePath! + "/SKMaps.bundle/AdvisorConfigs/Languages"

The event is define by :

 func routingService(routingService: SKRoutingService!, didChangeCurrentAdvice currentAdvice: SKRouteAdvice!, isLastAdvice: Bool) {

    NSLog("New advice "+currentAdvice.adviceInstruction)

}

Si I get "in 90 meters turn right " for instance.

By the way, no audio files are played neither

Could you please give me a hand :) ? Thank you in advance


Solution

  • There is a bug in the code that is supposed to "play the audio advice" (in AudioService.m) - the name of the .mp3 file was not correctly built.

    I've fixed this by making the following change:

    func playAudioFile(audioFileName: String) { 
        var soundFilePath: String = audioFilesFolderPath + "/" + audioFileName 
        soundFilePath = soundFilePath + ".mp3" 
    
        if !NSFileManager.defaultManager().fileExistsAtPath(soundFilePath) 
        { 
            return 
        } 
        else 
        { 
            audioPlayer = try? AVAudioPlayer(contentsOfURL: NSURL(fileURLWithPath: soundFilePath), fileTypeHint: nil) 
            audioPlayer.delegate = self 
            audioPlayer.play() 
        } 
    
    } 
    

    This affected only the swift demo and will be fixed in the next update