How to associate CSV file to my app in iOS 7 - ios

Good day, everyone.
I followed these two tutorials line by line, try to associate my app to the csv file (email app attachment), but I after I added these down below changes to my app's plist file, then build my app and run it my device (iPhone 4, iOS 7.0.4), nothing happens, I mean when I clicked on the .csv file in the email, my app still does not show up in the open-in available application list, I just don't know where I did wrong, or iOS 7 has different way doing this?
http://blog.spritebandits.com/2011/12/14/importing-csv-data-file-into-an-ios-app-via-email-attachment/
http://www.raywenderlich.com/1980/email-tutorial-for-ios-how-to-import-and-export-app-data-via-email-in-your-ios-app
this is what my plist changes (the new entries added followed by the tutorial) looks like:
here's the app setting screen:
and here's the xml version:
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeName</key>
<string>CSV Document</string>
<key>LSHandlerRank</key>
<string>Owner</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSItemContentTypes</key>
<array>
<string></string>
</array>
</dict>
</array>
<key>UTExportedTypeDeclarations</key>
<array>
<dict>
<key>UTTypeDescription</key>
<string>CSV Document</string>
<key>UTTypeConformsTo</key>
<array>
<string>public.data</string>
</array>
<key>UTTypeIdentifier</key>
<string>Damian-s.${PRODUCT_NAME:rfc1034identifier}</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
<string>csv</string>
<key>public.mime-type</key>
<string>application/inventorytodo</string>
</dict>
</dict>
</array>

You're missing the UTI type in your CFBundleDocumentTypes definition:
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeName</key>
<string>CSV Document</string>
<key>LSHandlerRank</key>
<string>Owner</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSItemContentTypes</key>
<array>
<string></string>
</array>
</dict>
</array>
should be:
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeName</key>
<string>CSV Document</string>
<key>LSHandlerRank</key>
<string>Owner</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSItemContentTypes</key>
<array>
<string>Damian-s.${PRODUCT_NAME:rfc1034identifier}</string>
</array>
</dict>
</array>

Related

Custom file type no longer showing in IOS mail app

I have an app on the appStore called Quiz Maker. With this app you can create a quiz and then email your quiz to another user with the Quiz Maker application.
To do this I created a custom file type called .qzm.
This has always worked well for a few years but now when you email a .qzm file as an attachment it does not open up in the shared selection window (the window that shows icons for Message, Email, Add to notes, WhatsApp etc....
I've tried every combination of setting with UTExportedTypeDeclarations and UTImportedTypeDeclarations but I just can't get the file /icon to show when the user taps on the attachment in the users mail client ??
Heres my settings (for security I've changed my business name to com.myBusiness)
<key>UTTypeConformsTo</key>
<array>
<string>public.data</string>
</array>
<key>UTTypeDescription</key>
<string>Quiz Maker File</string>
<key>UTTypeIconFiles</key>
<array/>
<key>UTTypeIdentifier</key>
<string>com.myBusiness.quizMaker.qzm</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
<array>
<string>qzm</string>
</array>
</dict>
</dict>
</array>
<key>UTImportedTypeDeclarations</key>
<array>
<dict>
<key>UTTypeConformsTo</key>
<array>
<string>public.data</string>
</array>
<key>UTTypeDescription</key>
<string>Quiz Maker File</string>
<key>UTTypeIconFiles</key>
<array/>
<key>UTTypeIdentifier</key>
<string>com.myBusiness.quizMaker.qzm</string>
</dict>
</array>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
<string>qzm</string>
</dict>
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeIconFiles</key>
<array/>
<key>CFBundleTypeName</key>
<string>Quiz Maker File</string>
<key>LSHandlerRank</key>
<string>Owner</string>
<key>LSItemContentTypes</key>
<array>
<string>com.myBusiness.quizMaker.qzm</string>
</array>
</dict>
</array>
Heres a screen shot of my settings as a pList:
All of the above code does not have icons (.pngs) but I don't think makes a difference at this stage as a blank icon would show.
I would really appreciate any help or ideas to solve this problem. Thanks
Problem solved - If you get stuck with the same problem, follow my code below:
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeIconFiles</key>
<array>
<string>inCommand icon114</string>
</array>
<key>CFBundleTypeName</key>
<string>qzm</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>LSHandlerRank</key>
<string>Owner</string>
<key>LSItemContentTypes</key>
<array>
<string>com.myBusiness.quizMaker.qzm</string>
</array>
</dict>
</array>
<key>UTExportedTypeDeclarations</key>
<array>
<dict>
<key>UTTypeConformsTo</key>
<array>
<string>public.data</string>
</array>
<key>UTTypeDescription</key>
<string>qzm</string>
<key>UTTypeIdentifier</key>
<string>com.myBusiness.quizMaker.qzm</string>
<key>UTTypeSize320IconFile</key>
<string>inCommand icon114</string>
<key>UTTypeSize64IconFile</key>
<string>inCommand icon57</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
<string>qzm</string>
<key>public.mime-type</key>
<string>application/quizMaker</string>
</dict>
</dict>
</array>

Associate MP3 with iOS app, "Open with..."

I have an iOS app I've already associated with ZIP files like so:
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeName</key>
<string>ZIP Archive</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>CFBundleTypeExtensions</key>
<array>
<string>zip</string>
</array>
<key>CFBundleTypeMIMETypes</key>
<array>
<string>application/zip</string>
<string>application/x-zip</string>
<string>application/x-zip-compressed</string>
</array>
<key>LSItemContentTypes</key>
<array>
<string>com.pkware.zip-archive</string>
</array>
</dict>
</array>
And this works as expected. When a user clicks a ZIP to download in Safari, my app comes up as an app to "Open with".
I'd like the same functionality for MP3. I've tried the following to no avail (app doesn't come up in the list). I've also tried subtle variations:
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeIconFile</key>
<string>beer-mug.png</string>
<key>CFBundleTypeExtensions</key>
<array>
<string></string>
</array>
<key>LSItemContentTypes</key>
<array>
<string>public.mp3</string>
</array>
<key>CFBundleTypeName</key>
<string>public.audio</string>
<key>LSHandlerRank</key>
<string>Owner</string>
</dict>
</array>
This image sums up what I'm going for:
Are MP3 files "protected" or something? I need a way for users to be able to download/access MP3 files in my iOS app (use as sound effects).
Surprisingly searching is coming up empty. Ideally someone with this MP3 functionality in their app posting their info.plist would be super helpful.
Why is your setup for mp3 so different than your setup for zip? The following fixes should work:
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeName</key>
<string>ZIP Archive</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>CFBundleTypeExtensions</key>
<array>
<string>zip</string>
</array>
<key>CFBundleTypeMIMETypes</key>
<array>
<string>application/zip</string>
<string>application/x-zip</string>
<string>application/x-zip-compressed</string>
</array>
<key>LSItemContentTypes</key>
<array>
<string>com.pkware.zip-archive</string>
</array>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>MP3</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>CFBundleTypeExtensions</key>
<array>
<string>mp3</string>
</array>
<key>CFBundleTypeMIMETypes</key>
<array>
<string>audio/mpeg</string>
<string>audio/mpeg3</string>
<string>audio/mpg</string>
<string>audio/mp3</string>
</array>
<key>LSItemContentTypes</key>
<array>
<string>public.mp3</string>
</array>
</dict>
</array>

CFBundleDocumentTypes not working with non-public UTI in iOS app

I want to add ability to open some specific types of audio in my app: .caf, .aiff, .wav and .mp3. I've added 'Document Types' item to the info.plist according to the official guide. Here is a screenshot:
And the source code of the info.plist:
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeName</key>
<string>Audio</string>
<key>CFBundleTypeIconFiles</key>
<array/>
<key>LSHandlerRank</key>
<string>Alternate</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSItemContentTypes</key>
<array>
<string>public.mp3</string>
<string>public.aiff-audio</string>
<string>public.aifc-audio</string>
<string>com.apple.coreaudio-​format</string>
<string>com.microsoft.waveform-​audio</string>
</array>
</dict>
</array>
The problem in question
The problem is that the app is missing in the "Open in..." dialog for .caf and .wav files. I guess because UTIs for that files have no public. perfix.
some missing extension no problem with that.
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeName</key>
<string>Audio</string>
<key>CFBundleTypeIconFiles</key>
<key>LSHandlerRank</key>
<string>Alternate</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSItemContentTypes</key>
<array>
<string>public.aiff-audio</string>
<string>public.aifc-audio</string>
<string>com.apple.coreaudio-​format</string>
<string>com.microsoft.waveform-​audio</string>
<string>public.audio</string>
<string>public.mp3</string>
<string>public.mpeg-4-audio</string>
<string>com.apple.protected-​mpeg-4-audio</string>
<string>public.aifc-audio</string>
<string>com.apple.coreaudio-​format</string>
<string>public.aiff-audio</string>
</array>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>Waveform audio</string>
<key>LSHandlerRank</key>
<string>Alternate</string>
<key>LSItemContentTypes</key>
<array>
<string>com.microsoft.waveform-​audio</string>
</array>
</dict>
</array>

Registering multiple file types for my iOS app

I've built an app that exports data via email. It takes the data, encodes in an NSData object adds an extension, then attaches it to an email. All of that works perfectly. The issue I'm having is when I open one of those emails, one of the file types I registered works fine. My app appears in the list of target apps and I can import the data with no issues.
For the other file type my app doesn't show up in the list of target apps. For both types, I've created entries in info.plist for Document Type, and for each type I've created a custom UTI with file extension.
I've looked at the configuration for both and the only differences I can see are the UTI I'm using, the extension for the UTI and the name of the document.
Am I missing something?
Relevant portions of info.plist:
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeIconFiles</key>
<array>
<string>appname144</string>
</array>
<key>CFBundleTypeName</key>
<string>appname Army Archive</string>
<key>LSHandlerRank</key>
<string>Owner</string>
<key>LSItemContentTypes</key>
<array>
<string>com.appnameeapp.archive.army</string>
</array>
</dict>
<dict>
<key>CFBundleTypeIconFiles</key>
<array>
<string>appname144</string>
</array>
<key>CFBundleTypeName</key>
<string>appname List Archive</string>
<key>LSHandlerRank</key>
<string>Owner</string>
<key>LSItemContentTypes</key>
<array>
<string>com.appnameapp.archive.list</string>
</array>
</dict>
</array>
<key>UTExportedTypeDeclarations</key>
<array>
<dict>
<key>UTTypeConformsTo</key>
<array>
<string>public.data</string>
</array>
<key>UTTypeDescription</key>
<string>appname Army</string>
<key>UTTypeIdentifier</key>
<string>com.appnameapp.archive.army</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>puclic.filename-extension</key>
<string>wfarmy</string>
</dict>
</dict>
<dict>
<key>UTTypeConformsTo</key>
<array>
<string>public.data</string>
</array>
<key>UTTypeDescription</key>
<string>appname List</string>
<key>UTTypeIdentifier</key>
<string>com.appnameapp.archive.list</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
<string>wflist</string>
</dict>
</dict>
</array>

How can I get my app in "Open with" [duplicate]

This question already has answers here:
How do I associate file types with an iPhone application?
(5 answers)
Closed 10 years ago.
I'm just looking for a way to have my app proposed in the "Open with" menu.
I saw this StackOverflow topic on the subject, I set the necessary lines in the plist file but my app is still not proposed.
How can I do this ?
Here is the code I set in the plist :
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>pdf</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>app.icns</string>
<key>CFBundleTypeName</key>
<string>public.pdf</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>LSHandlerRank</key>
<string>Owner</string>
<key>LSItemContentTypes</key>
<array>
<string>public.pdf</string>
</array>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>png</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>app.icns</string>
<key>CFBundleTypeName</key>
<string>public.png</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>LSHandlerRank</key>
<string>Owner</string>
<key>LSItemContentTypes</key>
<array>
<string>public.png</string>
</array>
</dict>
</array>
and
<key>UTImportedTypeDeclarations</key>
<array>
<dict>
<key>UTTypeConformsTo</key>
<array>
<string>public.data</string>
</array>
<key>UTTypeIdentifier</key>
<string>public.pdf</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>com.apple.ostype</key>
<string>PDF</string>
<key>public.filename-extension</key>
<array>
<string>pdf</string>
</array>
<key>public.mime-type</key>
<string>application/pdf</string>
</dict>
</dict>
<dict>
<key>UTTypeConformsTo</key>
<array>
<string>public.image</string>
</array>
<key>UTTypeIdentifier</key>
<string>public.png</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>com.apple.ostype</key>
<string>PNG</string>
<key>public.filename-extension</key>
<array>
<string>png</string>
</array>
<key>public.mime-type</key>
<string>image/png</string>
</dict>
</dict>
</array>
It looks like all you did was copy those entries from the other answer you linked to.
For PDF files and PNG images you don't need the second part (imported declarations) at all. Those are well known document types.
For the document types, I just do this:
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeName</key>
<string>PDF</string>
<key>LSHandlerRank</key>
<string>Alternate</string>
<key>LSItemContentTypes</key>
<array>
<string>com.adobe.pdf</string>
</array>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>PNG</string>
<key>LSHandlerRank</key>
<string>Alternate</string>
<key>LSItemContentTypes</key>
<array>
<string>public.png</string>
</array>
</dict>
</array>

Resources