0

I want to get the "Me" card's Name so when i create the mail window with MFMailComposeViewController

I can

MFMailComposeViewController *mailer = [[MFMailComposeViewController alloc] init];
mailer.mailComposeDelegate = self;
[mailer setSubject:@"Suggestion: from (Name of Person)"];

Basically substitute the (Name of Person) with the name on their contact card.

Cocoa Dev
  • 9,361
  • 31
  • 109
  • 177
  • 1
    Check [this answer](http://stackoverflow.com/a/3747877/529363) – Youssef Oct 03 '12 at 15:57
  • I know how 2 get all contacts. how do I determine if the contact card is "Me" (owner of the device). – Cocoa Dev Oct 03 '12 at 16:03
  • Maybe a better approach would be getting it from device name, it's not a perfect method but it's the best i [found](http://mobiledevelopertips.com/core-services/getting-the-iphone-user-name.html). – Youssef Oct 03 '12 at 16:11
  • the device name usually has the person's name but it's not always the case. It will look dumb saying "Suggestion from iPhone 5" instead of "Suggestion from John Doe" – Cocoa Dev Oct 03 '12 at 16:20
  • I know, but it is the closest solution I found, that's why I've posted it just as a comment ;) – Youssef Oct 03 '12 at 16:26
  • I like your suggestion @ender , do you have working code that can demonstrate this? – Cocoa Dev Oct 10 '12 at 14:21
  • check this [question](http://stackoverflow.com/questions/8261961/better-way-to-get-the-users-name-from-device) – Youssef Oct 10 '12 at 14:41

1 Answers1

2

You can't get the "Me" card from the iOS SDK. There's a me method for the mac, but not for iOS. If the name of the person will be in the From: field, what value is there in adding it to the subject line?

Christopher Pickslay
  • 17,523
  • 6
  • 79
  • 92
  • Some people have weird names (which aren't their real names). Some poeple just have no names and just an email address xyz@abc.com. There is many variations for the from field. I was hoping to make it easy for the receptionist when she gets the emails, she can sort by Subject and see the name quicker. – Cocoa Dev Oct 10 '12 at 14:20