Thanks Justin.
Let's say you have a root view controller (RVC) and a UIAlertViewController popup (AVC) presented with RVC.presentViewController(AVC).
UMPConsentForm's presentFromViewController(RVC) and loadAndPresentIfRequiredFromViewController(RVC) can fail and call the completion handler with error set to "The provided view controller is already presenting another view controller".
Furthermore, if you call consentForm.presentFromViewController(AVC) *while* AVC is being dismissed (via dismissViewController) with an animation, the operation silently fails. The completion handler is not called. This error message is printed to the console: "Attempt to present <UMPConsentViewController: 0xXXXXXXXXX> on <UIAlertController: 0xXXXXXXXXX> (from <UIAlertController: 0xXXXXXXXXX>) whose view is not in the window hierarchy."
It turns out it's the latter race condition that is causing me headaches. In my testing, consentForm.presentFromViewController is synchronous, so that's not the issue.
It's messy but it's possible to check AVC.isBeingDismissed and in that case, delay calling consentForm.presentFromViewController until after the dismiss animation has completed. I assume it's ok to hold a reference on consentForm to do this?
But... is there a simpler way?