Base64 codec of iOS Development Network chapter

Source: Internet
Author: User
Tags base64 encode

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.