MFMailComposeViewController lacks get accessors

hsoi blog, talk Leave a Comment


Apple’s iOS Application Programming Guide states that well-behaved iOS applications will preserve the state of the application’s user interface. There are many reasons for this, but suffice it to say it’s A Good Thing™.

Unfortunately I just hit a snag with this: MFMailComposeViewController.

MFMailComposeViewController provides the ability to have in-app support for sending emails. This is handy for creating a feature like “Email Support” so a user can directly email tech support from within the app, and since it’s in-app and within your control you can do something like pre-populate the To recipient with your support email address, put information like the OS version and app version within the message body, and other such things to make life easier for the user and the support contact much more useful.

Unfortunately, Apple made MFMailComposeViewController’s interface too simple: one can only set information, one cannot get information. So I can set the To recipients, but I can’t do anything to get them. This complicates the guideline to preserve state, since you can’t get the state to preserve it!

Yes, MFMailComposeViewController adheres to NSCoding, but the format is private. I tried using it and it didn’t quite work out. It doesn’t just preserve the data but the whole ViewController… and it just didn’t work when I tried it. The GUI came back in a bizarre state. 🙁

RADAR 9991257

Oh well. It’s not a critical issue.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.