1

I'm importing a file on iOS

When this delegate is called...

func documentPicker(controller:UIDocumentPickerViewController, didPickDocumentAtURL url:NSURL)

can I retrieve the mime type of the file? I need it to place in an email so that mail clients can open the attachment correctly?

Carl
  • 2,896
  • 2
  • 32
  • 50

1 Answers1

2

iOS doesn't provide content type via its documentPicker UI.

however, one can use the filename extension.

e.g., Mandrill: if user picks a file called "example.pdf"

encodedFileContent = ...

attachments:
[{
    type: "application/pdf",
    name: "example.pdf",
    content: encodedFileContent
}]
Carl
  • 2,896
  • 2
  • 32
  • 50