Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>There is a superb answer to this question <a href="https://stackoverflow.com/questions/2774343/how-do-i-associate-file-types-with-an-iphone-application/2781290#2781290">here</a>. I've copied some of the answer below for clarity, but you should refer to that question for the complete answer. </p> <p>File type handling is new with iPhone OS 3.2, and is different than the already-existing custom URL schemes. You can register your application to handle particular document types, and any application that uses a document controller can hand off processing of these documents to your own application.</p> <p>To register support, you will need to have something like the following in your Info.plist:</p> <pre><code>&lt;key&gt;CFBundleDocumentTypes&lt;/key&gt; &lt;array&gt; &lt;dict&gt; &lt;key&gt;CFBundleTypeIconFiles&lt;/key&gt; &lt;array&gt; &lt;string&gt;Document-molecules-320.png&lt;/string&gt; &lt;string&gt;Document-molecules-64.png&lt;/string&gt; &lt;/array&gt; &lt;key&gt;CFBundleTypeName&lt;/key&gt; &lt;string&gt;Molecules Structure File&lt;/string&gt; &lt;key&gt;CFBundleTypeRole&lt;/key&gt; &lt;string&gt;Viewer&lt;/string&gt; &lt;key&gt;LSHandlerRank&lt;/key&gt; &lt;string&gt;Owner&lt;/string&gt; &lt;key&gt;LSItemContentTypes&lt;/key&gt; &lt;array&gt; &lt;string&gt;com.sunsetlakesoftware.molecules.pdb&lt;/string&gt; &lt;string&gt;org.gnu.gnu-zip-archive&lt;/string&gt; &lt;/array&gt; &lt;/dict&gt; &lt;/array&gt; </code></pre> <p>One of the UTIs used in the above example was system-defined, but the other was an application-specific UTI. The application-specific UTI will need to be exported so that other applications on the system can be made aware of it. To do this, you would add a section to your Info.plist like the following:</p> <pre><code>&lt;key&gt;UTExportedTypeDeclarations&lt;/key&gt; &lt;array&gt; &lt;dict&gt; &lt;key&gt;UTTypeConformsTo&lt;/key&gt; &lt;array&gt; &lt;string&gt;public.plain-text&lt;/string&gt; &lt;string&gt;public.text&lt;/string&gt; &lt;/array&gt; &lt;key&gt;UTTypeDescription&lt;/key&gt; &lt;string&gt;Molecules Structure File&lt;/string&gt; &lt;key&gt;UTTypeIdentifier&lt;/key&gt; &lt;string&gt;com.sunsetlakesoftware.molecules.pdb&lt;/string&gt; &lt;key&gt;UTTypeTagSpecification&lt;/key&gt; &lt;dict&gt; &lt;key&gt;public.filename-extension&lt;/key&gt; &lt;string&gt;pdb&lt;/string&gt; &lt;key&gt;public.mime-type&lt;/key&gt; &lt;string&gt;chemical/x-pdb&lt;/string&gt; &lt;/dict&gt; &lt;/dict&gt; &lt;/array&gt; </code></pre> <p>This particular example exports the <code>com.sunsetlakesoftware.molecules.pdb</code> UTI with the .pdb file extension, corresponding to the MIME type <code>chemical/x-pdb</code>.</p> <p>With this in place, your application will be able to handle documents attached to emails or from other applications on the system. In Mail, you can tap-and-hold to bring up a list of applications that can open a particular attachment.</p> <p>When the attachment is opened, your application will be started and you will need to handle the processing of this file in your <code>-application:didFinishLaunchingWithOptions:</code> application delegate method. It appears that files loaded in this manner from Mail are copied into your application's Documents directory under a subdirectory corresponding to what email box they arrived in.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload