Skip to main content
Inspiring
September 25, 2012
Question

IOS File type association

  • September 25, 2012
  • 2 replies
  • 5330 views

I am trying to invoke my air app when a user clicks a text file in something like drop box.  I found the following through a bit of research but when I add it into my InfoAdditions, I get an error.

<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>txt</string>
<string>TXT</string>
</array>
<key>CFBundleTypeName</key>
<string>Text</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>

I am just getting started with IOS development.  What is currently in there right now is:

<key>UIDeviceFamily</key><array><string>1</string><string>2</string><string>2</string></array>

Any thoughts?  I just want to read in text from a text file.

Thanks


This topic has been closed for replies.

2 replies

Inspiring
September 25, 2012

Is that only part of your entry or are you missing the closing </dict></array> that needs to go on the end?

There are also some other keys that can go in there:

                                      <key>CFBundleTypeIconFiles</key>

                                      <array>

        <string>path-to-image64</string>

                                                <string>path-to-image320</string>

                                      </array>

                                      <key>LSItemContentTypes</key>

                                      <array>

                                                <string>public.text</string>

                                      </array>

                                      <key>LSHandlerRank</key>

                                      <string>Alternate</string>

mola2alexAuthor
Inspiring
September 25, 2012

@FLAdude, yep, I was missing those.  It now compiles ok but when I go into drop box and select a text file, I get 'No apps support opening this file'.  I want my app to be supporting of opening that file

Known Participant
November 5, 2012

Below is a sample to register your application for pdf files.

<key>CFBundleDocumentTypes</key>

<array>

<dict>

<key>CFBundleTypeName</key>

<string>my pdf viewer</string>

<key>CFBundleTypeRole</key>

<string>Viewer</string>

<key>LSHandlerRank</key>

<string>Owner</string>

<key>LSItemContentTypes</key>

<array>

<string>com.adobe.pdf</string>

</array>

</dict>

</array>

<key>UTExportedTypeDeclarations</key>

<array>

<dict>

<key>UTTypeDescription</key>

<string>my pdf viewer</string>

<key>UTTypeIdentifier</key>

<string>com.adobe.pdf</string>

<key>UTTypeTagSpecification</key>

<dict>

<key>public.filename-extension</key>

<string>pdf</string>

<key>public.mime-type</key>

<string>application/pdf</string>

</dict>

</dict>

  </array>

CFBundleDocumentTypes registers the File Types Your App Supports, and UTExportedTypeDeclarations is required so that other applications on the system are made aware of it.

With this in place your application will be able to handle documents attached to emails or from other applications on the system.



Sorry for digging out this old conversation but the approach above doesn't seem to work anymore. It works perfectly fine on iOS 5.x.x but not on iOS 6. I'm using Adobe AIR 3.4. Does anybody have the same problem? Is it something that is going to be addressed in Adobe AIR 3.5?

It is worth mentioning that application behaves quite weirdly. I can see my app icon in the Open With popup menu when trying to open a file of the registered type from an e-mail. But nothing happens when I click it.

Would greately appreciate any help. My users already started complaining.

Nimisha1
Participating Frequently
September 25, 2012

>>To invoke you air app from another native app you have to register your app with custom URI , you can get more information at http://help.adobe.com/en_US/air/build/WSfffb011ac560372f7e64a7f12cd2dd1867-8000.html#WS901d38e593cd1bac354f4f7b12e260e3e67-8000

Thanks,

Nimisha

mola2alexAuthor
Inspiring
September 25, 2012

Not really what I need.  I want to invoke my app based on a file type.  So registering my app for a specific file type.  Really need the equivalent to iOS as this is to Android:

<intent-filter>

      <data android:mimeType="text/plain" />

          <action android:name="android.intent.action.VIEW" />

          <category android:name="android.intent.category.DEFAULT" />

      </intent-filter>