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];

 

上一篇:#undef常用法


下一篇:【排障】nginx在reload时候报错invalid PID number