object-c base64
作者:互联网
// 64位编码
//先将string转换成data
NSData *data = [string dataUsingEncoding:NSUTF8StringEncoding];
NSData *base64Data = [data base64EncodedDataWithOptions:0];
NSString *baseString = [[NSString alloc]initWithData:base64Data encoding:NSUTF8StringEncoding];
// 64位解码
NSData *data = [[NSData alloc]initWithBase64EncodedString:base64String options:NSDataBase64DecodingIgnoreUnknownCharacters];
NSString *string = [[NSString alloc]initWithData:data encoding:NSUTF8StringEncoding];
标签:alloc,object,NSUTF8StringEncoding,string,base64,NSString,NSData,data 来源: https://www.cnblogs.com/manhelp/p/11918723.html