This took me by suprise today, when surfing the OS X Mavericks documentation: The NSData object now has built-in support for Base64 encoding and decoding.

We can now use:

We also have some new constants:

No more external Base64 frameworks anymore! Some more details from the Foundation Release Notes for OS X 10.9:

NSData has added an API in OS X 10.9 for encoding and decoding Base 64. The encoding algorithm can be configured to automatically insert line breaks with customizable line ending characters. The decoding algorithm by default will reject the entire input if it encounters any non-Base 64 characters (including whitespace), but there is an option available to make it more lenient. Depending on your needs, you can use one of the two variants of the encoding and decoding methods. One pair uses Base 64 encoded NSStrings and the other uses Base 64 encoded NSDatas.

If your application needs to target an operating system prior to OS X 10.9, you can use NSData’s -initWithBase64Encoding: and -base64Encoding instead. These methods have existed since OS X 10.6, but were not exposed until OS X 10.9. These methods behave like the new methods, except -initWithBase64Encoding: will ignore unknown characters. When your application no longer needs to target an operation system prior to OS X 10.9, you should transition to the new methods.