title: MFMessageComposeViewController iOS7 addAttachmentData:typeIdentifier:filename: not working
body: <p>I want to attach an image to a MMS, on iOS7. I wrote following code:</p>
  
  <pre><code>    MFMessageComposeViewController *messageController = [[MFMessageComposeViewController alloc] init];
      messageController.messageComposeDelegate = self;
  
      NSData *imgData = [NSData dataWithContentsOfFile:@"blablabla"];
      BOOL didAttachImage = [messageController addAttachmentData:imgData typeIdentifier:@"public.data" filename:@"image"];
  
      if (didAttachImage)
      {
          // Present message view controller on screen
          [self presentViewController:messageController animated:YES completion:nil];
      }
      else
      {
          UIAlertView *warningAlert = [[UIAlertView alloc] initWithTitle:@"Error"
                                                                 message:@"Failed to attach image"
                                                                delegate:nil
                                                       cancelButtonTitle:@"OK"
                                                       otherButtonTitles:nil];
          [warningAlert show];
          return;
      }
  </code></pre>
  
  <p>The problem is that when the SMS screen is presented, it doesn't recognize the image, and cannot send it. I see something like this:</p>
  
  <p><img src="https://i.stack.imgur.com/eDAvw.png" alt="Message Screen"></p>
  
  <p>I believe this has something to do either with imgData I am sending, or with typeIdentifier.</p>
  
  <p>Note: I tried almost all possible typeIdentifiers:
  @"public.data", @"public.image", @"public.item", ... etc. None worked.</p>
  
  <p>Can anybody please help me? What is the typeIdentifier you are using? I am testing on iPhone 5, iOS 7.0.2.</p>
  
  <p>Thanks.</p>
  
  <hr>
  
  <p><strong>SOLUTION:</strong></p>
  
  <p>As Greg instructed, this solved my problem: set filename as @"image.png", and typeIdentifier to kUTTypePNG.</p>
  
  <pre><code>[messageController addAttachmentData:imgData typeIdentifier:(NSString *)kUTTypePNG filename:@"image.png"];
  </code></pre>
  
  <p>Thanks Greg.</p>