2016-01-22 76 views
2

我是新與Skobbler SDK,並與雨燕演示+有據可查政黨成員學習(http://developer.skobbler.com/getting-started/ios#sec01更改建議的語言不工作

但是,我仍然無法使用他們的指令配置建議語言設置...

這裏是我的代碼:

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

    NSLog("New advice "+currentAdvice.adviceInstruction) 

} 

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

本次活動由定義

例如,我得到「在90米右轉」。

順便說一句,沒有音頻文件播放既不

能否請你給我一個手:)?謝謝你在前進

+0

我想有在法國的結果方式 ! – GrayFox

回答

1

有是應該在代碼中的錯誤「播放音頻建議」(在AudioService.m中) - .mp3文件的名稱未正確構建。

我已經進行以下更改固定的:

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

} 

這僅影響迅速演示,將其固定在下次更新

+0

是的Ando就是這樣:)!非常感謝你 – GrayFox

1

好吧,我發現我的錯誤更換:

settings.advisorType = SKAdvisorType.AudioFiles 

settings.advisorType = SKAdvisorType.TextToSpeech 

但是我還是不知道如何使用預先錄製的文件...即使有部分「在tuto中使用預先錄製的文件...

1

您是否將您的設置設置爲您的SKRoutingServiceadvisorConfigurationSettings

[SKRoutingService sharedInstance].advisorConfigurationSettings = advisorSettings; 

你也將需要設置的路徑是這樣的音頻文件:

NSBundle* advisorResourcesBundle = [NSBundle bundleWithPath:[[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"SKAdvisorResources.bundle"]]; 
NSString* soundFilesFolder = [advisorResourcesBundle pathForResource:@"Languages" ofType:@""]; 
NSString* audioFilesFolderPath = [NSString stringWithFormat:@"%@/%@/sound_files",soundFilesFolder,userLanguageCode]; 
[AudioService sharedInstance].audioFilesFolderPath = audioFilesFolderPath; 

userLanguageCode"fr"你的情況