views:

30

answers:

1

I'm enconding this data with this line:


NSString *authString = [[[NSString stringWithFormat:@"%@:%@", email, password] dataUsingEncoding:NSUTF8StringEncoding] base64Encoding];

for a basic HTTP Authentication

It works quite perfect but i'm getting this warning:

warning: 'NSData' may not respond to '-base64Encoding'

is there other way for encoding or how do i remove this warning?

+2  A: 

The warning is correct: NSData does not respond to that message. As you can see in the documentation, NSData does not implement base-64 encoding and decoding.

You'll need to either use OpenSSL's BIO API to do the job, or use a third-party framework or library that wraps that (or a separate encoder/decoder) in an easy Cocoa API. A Google search for “Cocoa Base64” will turn up some options.

Peter Hosey