NSData *nsdata = [@"iOS Developer Tips encoded in Base64"
dataUsingEncoding:NSUTF8StringEncoding];
NSString *base64Encoded = [NSData base64EncodedStringWithOptions:0];
NSLog(@"Encoded: %@", base64Encoded);
字符串,base64解密
NSData *nsdataFromBase64String = [[NSData alloc]
initWithBase64EncodedString:base64Encoded options:0];
NSString *base64Decoded = [[NSString alloc]
initWithData:nsdataFromBase64String encoding:NSUTF8StringEncoding];
NSLog(@"Decoded: %@", base64Decoded);
时间: 2024-11-09 04:48:11