xcode iphone base64 encode/decode
첨부파일을 다운로드 받고 import 후 아래와 같이 사용 1136870320.h NSString *sourceString = @”username:password”; NSLog(@”Original string: %@”, sourceString); NSData *sourceData = [sourceString dataUsingEncoding:NSUTF8StringEncoding]; NSString *base64EncodedString = [sourceData base64Encoding]; NSLog([NSString stringWithFormat:@”Encoded form: %@”, base64EncodedString]); NSData *decodedData = [NSData dataWithBase64EncodedString:base64EncodedString]; NSString *decodedString = [[[NSString alloc] initWithData:decodedData encoding:NSUTF8StringEncoding] autorelease]; NSLog([NSString stringWithFormat:@”Decoded again: %@”,decodedString]);