ABGetMe with the iPhone SDK
Unlike the Mac Address Book API, the iPhone Address Book API does not come with the ABGetMe function. That's a pity, but we can do something about it.
Recently, I used MFMailComposeViewController for the first time and I realized that it was displaying my e-mail address. Nicolas Seriot already demonstrated how to retrieve all your e-mail account information in SpyPhone, but I felt there was a more lightweight method for retrieving the e-mail addresses by taking advantage of the MessageUI framework. A class-dump and five minutes later, here is my solution:
4 comments:
Cédric,
I can't seem to use this. Is it limited to a certain version of the iOS by any chance?
Duh, should have done a little trying before posting. In fact, the class name has changed to MFMailComposeController (not sure if it happened in 3.2 or 4.0 though)
No, that's MailComposeController, it's an internal class of MFMailComposeController. You must link with the MessageUI framework for this code to work.
My bad, the +accountEmailAddresses method has indeed changed in iOS 3.2 or 4.0 and is now on the MFMailComposeController class. The code is updated to acknowledge that change.
Post a Comment