#import "NSData+Base64.h"
{
NSString *str =@"tix.lo";
NSData *strData = [str dataUsingEncoding:NSUTF8StringEncoding];
NSString *encodedStr = [strData base64EncodedString];
NSLog(@"Base64 Encoded: %@",encodedStr);
//Base64 Decoding
NSData *decodedData = [NSData dataFromBase64String:encodedStr];
NSString *decodedStr = [[NSString alloc] initWithData:decodedData encoding:NSUTF8StringEncoding];
NSLog(@"Base64 Decoded: %@",decodedStr );
}
source from : reference
沒有留言:
張貼留言