系统自带方法
NSString *hanziText = @"我是中国人";
if ([hanziText length]) {
NSMutableString *ms = [[NSMutableString alloc] initWithString:hanziText];
if (CFStringTransform((__bridge CFMutableStringRef)ms, 0, kCFStringTransformMandarinLatin, NO)) {
NSLog(@"带音标的pinyin: %@", ms);
if (CFStringTransform((__bridge CFMutableStringRef)ms, 0, kCFStringTransformStripDiacritics, NO)) {
NSLog(@"不带音标的pinyin: %@", ms);
}
}
}