title: How to attach a plist into an email in Xcode?
body: <p>I am working on a quiz app where the user's input will be stored inside a plist files.  I tried researching for various ways to attach files to an email, but mostly are all for JPEG and TXT files.</p>
  
  <p>I have created a plist and tried to attach the it the same way, but on the mailcomposer it only shows the filename of the attachment.</p>
  
  <pre><code>    -(NSString *) dataFilePath
  {
      NSArray *path = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
      NSString *documentDirectory = [path objectAtIndex:0];
      return [documentDirectory stringByAppendingPathComponent:@"Answer.plist"];
  }
  </code></pre>
  
  <p>This is the code in the composer</p>
  
  <pre><code>-(IBAction) openEmail {
  MFMailComposeViewController *mailComposer = [[MFMailComposeViewController alloc] init];
  [mailComposer setMailComposeDelegate:self];
  if ([MFMailComposeViewController canSendMail]) {
      [mailComposer setToRecipients:[NSArray arrayWithObjects:@"secondary_Example@email.com", nil]];
      [mailComposer setSubject:@"Subject Topic"];
      [mailComposer setMessageBody:@"Message Body" isHTML:NO];
      [mailComposer setModalTransitionStyle:UIModalTransitionStyleCrossDissolve];
  
  
      NSString *path = [[NSBundle mainBundle] pathForResource:@"Answer" ofType:@"plist"];
      NSData *myData = [NSData dataWithContentsOfFile:path];
      [mailComposer addAttachmentData:myData mimeType:@"application/xml" fileName:@"Answers"];
  
         [self presentModalViewController:mailComposer animated:YES]; }}
  </code></pre>
  
  <p>Am I missing something out? Please help.. Would really appreciate it.</p>