// 转换成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转换
时间: 2024-10-10 11:13:10