// 转换成base64编码, string明文字符串 NSData *data = [string dataUsingEncoding:NSUTF8StringEncoding]; NSString *stringBase64 = [data base64Encoding]; // base64格式的字符串
// 由base64转成明文 NSData *data = [[NSData alloc] initWithBase64EncodedString:stringBase64 options:NSDataBase64DecodingIgnoreUnknownCharacters]; NSString *string =[[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
NSString与Base64转换,布布扣,bubuko.com
原文:http://blog.csdn.net/yang2735/article/details/38299463