Chappy 003
Chappy 003

Reputation: 436

How to attach a file of any types to the Email in iOS

I am interpreting a function onto my iOS App to attach an original data on the Email as a file. The app is a movie composer.

The data format is written as XML and I want the app to attach the data on the Email as the file with an original extension (.kpt). Besides, I want the receiver to open the received XML file using the movie composer.

The question is the following:

  1. How to let the app to attach the original data to the email with an original extension?
  2. How to let the email receiver to open the received file using my app?

Upvotes: 0

Views: 1252

Answers (1)

Wayne Hartman
Wayne Hartman

Reputation: 18477

How to setup an attachment:

MFMailComposeViewController *mailController = [[MFMailComposeViewController alloc] init];
[mailController setSubject:@"Some Subject"];
[mailController addAttachmentData:data
                         mimeType:@"application/kpt"
                         fileName:@"originalFileName.kpt"];

In order to open the file inside your app, you will need to modify your Info.plist to describe a new document UTI. The programming guide for doing this can be found here.

Upvotes: 1

Related Questions