iOS返回的JSON資料中的unicode 轉換為中文

kunnan發表於2017-11-20

前言

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

相關文章