Shimen the main contribution, respect the work of the author, please do not reprint.
If the article is helpful to you, you are welcome to donate to the author, support the Shimen, donate the amount at random, ^_^
I want to donate: Click Donate
Cocos2d-x source Download: Dot I teleport
Games Official Download:HTTP://DWZ.CN/RWTJL
Game video preview:http://dwz.cn/RzHHd
Game Development Blog:Http://dwz.cn/RzJzI
Game Source Transfer : Http://dwz.cn/Nret1
In the development of the iphone, it is often necessary to encode the data Base64.
In some large projects, it is necessary to Base64 encode the data encrypted by the RSA encryption algorithm,
The iphone data is then routed over the network to the server side,
The server side receives the data and then decodes it, then processes the decoded data.
1. Interface definition
@interface NSData (BASE64)
+ (NSData *) datafrombase64string: (NSString *) astring;
-(NSString *) base64encodedstring: (Nsinteger) Separatelines;
2. Coding
NSData *stringdata = [ self datausingencoding:nsutf8stringencoding];
nsstring *encodedstring = [StringData base64encodedstring:0];
3. Decoding
nsdata *data = [nsdata datafrombase64string: base64binary];
Interface: Click I download
If no points, the blog below reply to leave an email address.
Shimen the main contribution, respect the work of the author, please do not reprint.
If the article is helpful to you, you are welcome to donate to the author, support the Shimen, donate the amount at random, ^_^
I want to donate: Click Donate
Cocos2d-x source Download: Dot I teleport
Games Official Download:HTTP://DWZ.CN/RWTJL
Game video preview:http://dwz.cn/RzHHd
Game Development Blog:Http://dwz.cn/RzJzI
Game Source Transfer : Http://dwz.cn/Nret1
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Base64 codec of iOS Development Network chapter