GTMBase64 iOS

#import "GTMBase64.h"

- (void)testExample
{
    NSData *data = [@"HelloWorld" dataUsingEncoding:NSUTF8StringEncoding allowLossyConversion:YES];
    NSString* encoded = [[NSString alloc] initWithData:[GTMBase64 encodeData:data] encoding:NSUTF8StringEncoding]; 
    NSLog(@"encoded:%@", encoded);
    NSString* decoded = [[NSString alloc] initWithData:[GTMBase64 decodeString:encoded] encoding:NSUTF8StringEncoding];
    NSLog(@"decoded:%@", decoded);
    [encoded release];
    [decoded release];
}


http://code.google.com/p/google-toolbox-for-mac/source/browse/trunk/Foundation/?r=87
posted @ 2013-07-06 11:54  李伯波  阅读(675)  评论(0编辑  收藏  举报