iPhone alert with prompt (textfield)

A lot of examples about alert with textfield show, that you can add the textfield element with the [alert addTextFieldWithValue: label:”] method. However (as it is stated in the articles), this method is private, and Apple rejects in when passing to app store. (maybe the method is removed from UIAlertView in the latest SDK)
Here is the right way with addSubview, including a little helper class as well:

I have also included the helper class here: