Create Random Django Compatible Usernames in Objective-C

I’m working on an app right now that lets anonymous users update data.  Only I don’t quite want them to be anonymous. I want to be able to keep track of “who” data belongs too in order to provide individual service.  So I needed to create unique usernames to register with the server.  I extended the NSString class and add a UUID method.  Problem with that is the resulting string was too long for Django.  So I added another method to convert it to a base 64 ASCII string of alphanumeric characters (and two special characters).  Here’s my implementation file.

Working well for me.  Now I need to look into getting Django TastyPie APIs setup to use this.

Base 64 implementation credit goes to StackOverflow.  I’m afraid that I don’t remember where I pulled the UUID method from, though I have tweaked it a fair amount since.