Search code examples
objective-cioscocoa-touchmfmessagecomposeviewcontroller

iOS – Check if MFMessageComposeViewController is currently visible


I need to check if MFMessageComposeViewController is currently visible. How can I do that?

What I'm doing right now is:

//Get the current visible view controller
ViewController *visible = ...

if([visible isKindOfClass:[MFMessageComposeViewController class]])
// This doesn't work because the class is actually CKSMSComposeController

And I can't check for CKSMSComposeController then Xcode will complain about "Use of undeclared identifier 'CKSMSComposeController'"


Solution

  • Adding a boolean after you have presented the modal view controller is the easiest way.