惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

美团技术团队
罗磊的独立博客
SecWiki News
SecWiki News
The Register - Security
The Register - Security
The GitHub Blog
The GitHub Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - 三生石上(FineUI控件)
S
Schneier on Security
IT之家
IT之家
博客园 - 聂微东
T
The Exploit Database - CXSecurity.com
Recorded Future
Recorded Future
大猫的无限游戏
大猫的无限游戏
Know Your Adversary
Know Your Adversary
Latest news
Latest news
Vercel News
Vercel News
G
GRAHAM CLULEY
D
DataBreaches.Net
D
Darknet – Hacking Tools, Hacker News & Cyber Security
S
SegmentFault 最新的问题
博客园_首页
雷峰网
雷峰网
T
Tenable Blog
Spread Privacy
Spread Privacy
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
酷 壳 – CoolShell
酷 壳 – CoolShell
Cisco Talos Blog
Cisco Talos Blog
V
Visual Studio Blog
J
Java Code Geeks
博客园 - Franky
The Cloudflare Blog
Apple Machine Learning Research
Apple Machine Learning Research
C
CERT Recently Published Vulnerability Notes
T
Threatpost
Google DeepMind News
Google DeepMind News
F
Fortinet All Blogs
P
Privacy International News Feed
T
Threat Research - Cisco Blogs
T
The Blog of Author Tim Ferriss
V
Vulnerabilities – Threatpost
Recent Announcements
Recent Announcements
Blog — PlanetScale
Blog — PlanetScale
Security Latest
Security Latest
U
Unit 42
M
MIT News - Artificial intelligence
Y
Y Combinator Blog
K
Kaspersky official blog
有赞技术团队
有赞技术团队
B
Blog
腾讯CDC

博客园 - 1901

试用Github Pages iOS设备内存及分辨率 测试显示GitHub的Gist 颜色转换工具 先随便记一下 iOS中获取程序相关的一些目录路径 mac字典词库增加方法 Google的Logo记现代舞先驱玛莎·葛兰姆117周年诞辰-Flash版 关于flash加载flash时的缩放和位置问题 给力壁纸 for mac 【转载】巧用宏定义来简写C,C++代码 Objective-C中的NSObject对象经常使用到的方法 Objective-C属性介绍 应用程序本地化-国家代码介绍(ISO 3166-1) iPhone开发资料 sourceMate2 我在MACOS下常用的软件 【转载】分享一些FLASH开发时用到的工具~ 关于ActionScript3中的事件类强制转换失败的问题
使用GTMBase64编码解码字符串
1901 · 2012-04-10 · via 博客园 - 1901

使用GTMBase64需要在工程中加入三个文件

示例代码:

#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];
}

输出:

2012-04-10 12:13:10.121 fs_test[7370:b603] encoded:SGVsbG9Xb3JsZA==
2012-04-10 12:13:10.122 fs_test[7370:b603] decoded:HelloWorld

--kaixuan's cnblogs

posted @ 2012-04-10 12:40  1901  阅读(4135)  评论()    收藏  举报