IOS- High German map commonly used function analysis

Has been in the Jane books to learn a lot of knowledge, I also want to share some knowledge for your advice, just recently in the study of high moral map API, so share your recent fiddle.

To use high German API, the first to go to the High German API website registered developers account, create value for key application. Then create your own project pod de SDK locally, thinking ahead if they need to navigate in pod, where I had been pit, because the navigation SDK contains the search SDK, search and navigation SDK SDK if pod will be reported to link errors, if you can not search pod navigation SDK. The last is to import the corresponding header files, and then configure the key.

Const static *APIKey = @ @ key for your application; NSString;

Key
/ / user configuration

[MAMapServices sharedServices].apiKey = (NSString *) APIKey;

/ / search

[AMapSearchServices sharedServices].apiKey = (NSString *) APIKey;

/ / navigation

[AMapNaviServices sharedServices].apiKey = (NSString *) APIKey;

The following can be written in accordance with the guidelines for its development, it is necessary to note that the path planning is based on the path search on the path planning to complete the first path search. Speech synthesis navigation, I was online with speech synthesis iFLYTEK, offline like charges, in a poor ape. High German navigation demo seems to be with the xunfei. Go to the Xunfei API official website registered account, create an application, access to key, and then configure the voice.

Set the SDK / / log level,
log to save the working path in the following settings

[IFlySetting setLogFile:LVL_ALL];

Open / output in log switch console

[IFlySetting showLogcat:YES];

/ / working path set SDK

NSArray *paths = NSSearchPathForDirectoriesInDomains (NSCachesDirectory, NSUserDomainMask, YES);

NSString *cachePath = [paths objectAtIndex:0];

[IFlySetting setLogFilePath:cachePath];

/ / configuration parameters

– (void) configIFlySpeech

{

[IFlySpeechUtility createUtility:[NSString stringWithFormat:@ “appid=%@, timeout=%@”, “5733feca”, “@ @ 20000” “;

[IFlySetting setLogFile:LVL_NONE];

[IFlySetting showLogcat:NO];

/ / set the parameters of speech synthesis

[[IFlySpeechSynthesizer sharedInstance] setParameter:@ “50” forKey:[IFlySpeechConstant SPEED]]; / / synthesis speed range 0~100

[[IFlySpeechSynthesizer sharedInstance] setParameter:@ “50” forKey:[IFlySpeechConstant VOLUME]]; / / synthesis volume range of 0~100;

/ / pronunciation, the default is “Xiaoyan”; can refer to the list of parameters set personalized pronunciation list;

[[IFlySpeechSynthesizer sharedInstance] setParameter:@ “Xiaowang” forKey:[IFlySpeechConstant VOICE_NAME]];

/ / audio sample rate, currently supports the sampling rate is 16000 and 8000;

[[IFlySpeechSynthesizer sharedInstance] setParameter:@ “8000” forKey:[IFlySpeechConstant SAMPLE_RATE]];

When you don’t need to / / save audio, please where necessary to add this line.

[[IFlySpeechSynthesizer sharedInstance] setParameter:nil forKey:[IFlySpeechConstant TTS_AUDIO_PATH]];

}

Then initialize and set the proxy.

– (void) initIFlySpeech {

If (self.iFlySpeechSynthesizer = Nil)

{

_iFlySpeechSynthesizer = [IFlySpeechSynthesizer sharedInstance];

}

_iFlySpeechSynthesizer.delegate = self;

}

/ / voice failed callback proxy function

– (void) onCompleted: (IFlySpeechError *) error {

NSLog (@ Speak Error:{%d:%@}), error.errorCode, error.errorDesc);

}

High German navigation has a callback function that returns a string voice navigation, create asynchronous threads in the callback function, the string of synthesized speech, and play, close the callback function button and close off playing in High German navigation click navigation.

#pragma mark – voice call (navigation callback)

– (void) naviManager: (AMapNaviManager *) naviManager playNaviSoundString: (NSString *) soundString soundStringType: (AMapNaviSoundType) soundStringType {

If (soundStringType = = AMapNaviSoundTypePassedReminder) {

/ / voice system

AudioServicesPlaySystemSound (1009);

}else {

Open / asynchronous thread (global)

Dispatch_async (dispatch_get_global_queue (DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0), ^{

[_iFlySpeechSynthesizer startSpeaking:soundString];

});

}

}

/ / this is a callback function, click the close button (that is, the navigation interface crosses)

– (void) naviViewControllerCloseButtonClicked: (AMapNaviViewController *) naviViewController {

Dispatch_async (dispatch_get_global_queue (DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0), ^{

[self.iFlySpeechSynthesizer stopSpeaking];

});

[self.naviManager stopNavi];

[self.naviManager dismissNaviViewControllerAnimated:YES];

}

Above is my recent research of High German API, one of the recent summary of study two is to help just contact High German people, want to help you write a bit of a mess, the first time ah, later it will become better and better. If you are wrong, please point out. Thank you

Has been in the Jane books to learn a lot of knowledge, I also want to share some knowledge for your advice, just recently in the study of high moral map API, so share your recent fiddle.

});

[self.naviManager stopNavi];

[self.naviManager dismissNaviViewControllerAnimated:YES];

}

  以上就是我最近研究的高德API,一是对最近学习的总结,二是希望帮助刚刚接触高德的人,希望对你们有帮助,文章写得有点乱,第一次啊,以后肯定会越来越好。如有错误欢迎各位指出。谢谢。