I kind of understand why I’m getting this analyzer warning. Because I’m using an object that is being passed in. I’ve tried autorelease and retain however these cause me other problems like unrecognized selector sent to instance.
The aim of my CommonUI function is to re-use code, but I have to cater for addSubView and presentModalViewController.
Perhaps I’m doing some obvious wrong ?

There are two problems here.
First, if you call
[vc release](as the other answers suggest), you’ll certainly make the analyzer happy but likely crash the app. A view controller’s view doesn’t retain the controller, so any button targets in the view will be pointing to garbage.You will need to somehow keep the
HelpViewControllerretained for as long as it is showing up onscreen. The “parent” view controller should likely retain it somehow. You could autorelease it, and return it. Then whomever callsshowHelpClick...would retain the returned controller.Second, you don’t need to have the
(UIViewController *)vcpassed in as an argument.