Book Image

Application Development in iOS 7

By : Kyle Begeman
Book Image

Application Development in iOS 7

By: Kyle Begeman

Overview of this book

Table of Contents (15 chapters)
Application Development in iOS 7
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

NSData


Every application uses data in some way or another. In some instances, you may require the ability to manipulate individual bytes of data. NSData encapsulates these raw bytes to allow for easy manipulation using built-in methods.

With iOS 7, NSData now adds support for Base64 encoding and decoding; a group of ACSII format binary-to-text encoding schemes. These schemes are most commonly used to transfer data between media that only support text-based data transfer. Encoding images from JSON-based responses from a web API is the most common use for these schemes.

Prior to iOS 7, developers were required to use a third-party library or build their own from scratch. Apple has made it exceptionally easy to use these encoding methods with the following methods:

- (id)initWithBase64EncodedData:(NSData *)base64Data 
  options:(NSDataBase64DecodingOptions)options;

- (NSData *)base64EncodedDataWithOptions:
  (NSDataBase64EncodingOptions)options;

- (id)initWithBase64EncodedString:(NSString *...