iOS返回的JSON数据中的unicode 转换为中文

前言

https://github.com/zhangkn/ZX…

Alcatraz is an open-source package manager for Xcode 7

https://github.com/alcatraz/A…

Until there's a new release, this will install Alcatraz for you, then clean up after itself:

git clone https://github.com/alcatraz/Alcatraz.git
cd Alcatraz
xcodebuild
cd ..
rm -rf Alcatraz

iOS返回的JSON数据中的unicode 转换为中文


+ (NSString*)convertUnicode:(NSString *)aString
{
    NSMutableString *convertedString = [aString mutableCopy];
    [convertedString replaceOccurrencesOfString:@"\\U" withString:@"\\u" options:0 range:NSMakeRange(0, convertedString.length)];
    CFStringRef transform = CFSTR("Any-Hex/Java");
    CFStringTransform((__bridge CFMutableStringRef)convertedString, NULL, transform, YES);
    return convertedString;
}

xcode8下安装alcatraz成功,具体操作是:


git clone https://github.com/alcatraz/Alcatraz.git
cd Alcatraz
xcodebuild
cd ..
rm -rf Alcatraz
  • Xcode 9 install success:


gem install update_xcode_plugins
update_xcode_plugins --unsign
cd /tmp
git clone https://github.com/alcatraz/Alcatraz.git
cd Alcatraz
xcodebuild
All done, if you want to restore:

update_xcode_plugins --restore
Then, the Xcode will resigned. Enjoy it.
https://github.com/inket/update_xcode_plugins
    原文作者:kunnan
    原文地址: https://segmentfault.com/a/1190000012077248
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞