使用苹果提供的汉字转拼音方法
NSMutableString * ms = [[NSMutableString alloc] initWithString:@"中华人民共和国"];
if (CFStringTransform((__bridge CFMutableStringRef)ms, 0, kCFStringTransformMandarinLatin, NO)) {
NSLog(@"pinyin: %@", ms);
}//有声调
if (CFStringTransform((__bridge CFMutableStringRef)ms, 0, kCFStringTransformStripDiacritics, NO)) {
NSLog(@"pinyin: %@", ms);
}//无声调