Since every Objective-C app that needs Basic Authentication needs this, you’d think there’d be a built in method in one of the NSURLConnection family of classes to do this little transform. There’s not, so you gotta build this yourself.
Even given the fact that Googling “Base64 encoder C” yields 191,000 hits, it seems like implementing this in Objective-C hangs up a lot of people.
It shouldn’t.
Objective-C syntactically is, at it’s heart, just C.
Therefore, it is easy to find most any routine in the wild coded in the last 30 years in C – somewhere – to do most anything you need to do.
A little later today I’ll post a Base64 encoder example that will hopefully clear away some roadblocks and cobwebs for some of my commenters.