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>
Related
Is that possible using the following ?
<dict>
<key>CFBundleTypeName</key>
<string>Open All Files</string>
<key>LSHandlerRank</key>
<string>Owner</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>LSItemContentTypes</key>
<array>
<string>public.content</string>
<string>public.data</string>
</array>
</dict>
I know for photos its possible but how should I do it for youtube kindly suggest.
For video sharing you can use, "public.video (kUTTypeVideo)". For ex.,
<dict>
<key>CFBundleTypeIconFiles</key>
<array/>
<key>CFBundleTypeName</key>
<string>Video</string>
<key>LSItemContentTypes</key>
<array>
<string>public.movie</string>
</array>
</dict>
You can find other document type identifiers here : DeclaredUniformTypeIdentifiers
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>
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>
I want to show the my app to the user when user use the open in function from the other app.
Here is my code.
<array>
<dict>
<key>CFBundleTypeName</key>
<string>Image File</string>
<key>LSHandlerRank</key>
<string>Default</string>
<key>LSItemContentTypes</key>
<array>
<string>public.png</string>
<string>public.jpg</string>
</array>
</dict>
</array>
What is wrong with that?
ScreeShot
I have associated a filetype with my iOS app, which works fine. However I want the file type to be exclusive, so that other applications do not offer to 'open in' my file.
I have an app by another developer that does this, but I can't work out how it is done. I have extracted the plist for this app and I cannot see what it is doing to make this happen.
This is what I want to do :
This is what happens in my App:
This is how I have the file associations setup in my plist:
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>abcd</string>
</array>
<key>CFBundleTypeName</key>
<string>My File</string>
<key>LSHandlerRank</key>
<string>Owner</string>
<key>LSItemContentTypes</key>
<array>
<string>com.myapp.abcd</string>
</array>
</dict>
</array>
<key>UTExportedTypeDeclarations</key>
<array>
<dict>
<key>UTTypeConformsTo</key>
<array>
<string>com.myapp.abcd</string>
</array>
<key>UTTypeDescription</key>
<string>My File</string>
<key>UTTypeIconFile</key>
<string>icon</string>
<key>UTTypeIdentifier</key>
<string>com.myapp.abcd</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
<array>
<string>abcd</string>
</array>
</dict>
</dict>
</array>
What am I missing?? Does anyone know how to enable this functionality?
Thanks
Duncan