首页 > 代码库 > NSString与Base64转换

NSString与Base64转换

	// 转换成base64编码, string明文字符串
	NSData *data = http://www.mamicode.com/[string dataUsingEncoding:NSUTF8StringEncoding];>


	// 由base64转成明文
	NSData *data = [[NSData alloc] initWithBase64EncodedString:stringBase64 options:NSDataBase64DecodingIgnoreUnknownCharacters];
	NSString *string =[[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];