开发者

Base64 Encode and decode

i need to encode some string(like UID,PWD) using Base64 in objective C how can i do it. can anybody share the 开发者_运维知识库code.

Thanks in advance


I am using the xmppframework library for my iphone project, and there are these two NSData Categories that take care of encoding(decoding) to(from) base64.

NSDataAdditions.h

NSDataAdditions.m

You should be able to use this category in your project.


While Sailesh's answer is probably the easiest way, Apple also provides some (more low level) example code in the "Security Transforms Programming Guide".

https://developer.apple.com/library/mac/#documentation/Security/Conceptual/SecTransformPG/SecurityTransformsBasics/SecurityTransformsBasics.html

However this is only available in Mac OS 10.7 or higher.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜