However self.parentViewController not working is in fact new to iOS 5. It has been ‘replaced’ with self.presentingViewController.

This causes an interesting problem for code trying to be pre-iOS 5 compatible. Since as you have foundself.parentViewController returns nil on iOS 5. And UIViewControllers do not respond topresentingViewController pre-iOS 5.

It leaves us doing something like this:

if ([self respondsToSelector:@selector(presentingViewController)]){
[self.presentingViewController dismissModalViewControllerAnimated:YES];
}
else {
[self.parentViewController dismissModalViewControllerAnimated:YES];
}