Add in a check to see if the presentViewController and dismissViewController methods are available, before using them.