J'essaie de mettre en œuvre le processus d'enregistrement qui permet à mon application iOS de s'afficher dans la liste "Ouvrir dans" des autres applications (comme décrit dans Rubriques de programmation de l'interaction de documents d'Apple ). Je souhaite que mon application puisse gérer l'audio à partir de n'importe quelle application fournissant un format de fichier audio standard (MP3, AIFF, WAV, etc.).
Si je comprends bien, tout ce que je devrais faire est d’ajouter la clé CFBundleDocumentTypes
, avec les données secondaires correspondantes, à Info.plist de mon application. Voici ce que j'ai écrit (via l'éditeur de types de documents de Xcode 4):
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeIconFiles</key>
<array>
<string>scrubbulator-icon</string>
</array>
<key>CFBundleTypeName</key>
<string>Audio</string>
<key>LSHandlerRank</key>
<string>Alternative</string>
<key>LSItemContentTypes</key>
<array>
<string>public.mp3</string>
</array>
</dict>
</array>
L'ajout de ce code n'affiche pas mon application dans le menu "Ouvrir dans" des applications (je teste sur un iPhone en utilisant un fichier MP3 dans Dropbox. Les applications AudioMemos et Evernote sont toutes deux affichées pour un fichier MP3 dans Dropbox. , donc je sais que le format est supporté). Y a-t-il quelque chose d'évident que je fais mal ou y a-t-il autre chose que je dois mettre en œuvre?
(Remarque: je n'ai pas configuré d'objet UTExportedTypeDeclarations
dans mon fichier Info.plist, car je sais que ces éléments ne sont nécessaires que pour les UTI personnalisées. Comme j'utilise des UTI système, je pense que cela ne devrait pas être nécessaire, mais corrigez-moi si Je me trompe.)
MODIFIER
J'ai ajouté le type UTI exporté suivant, sans succès:
<key>UTExportedTypeDeclarations</key>
<array>
<dict>
<key>UTTypeConformsTo</key>
<array>
<string>kUTTypeMP3</string>
</array>
<key>UTTypeDescription</key>
<string>Audio file</string>
<key>UTTypeIdentifier</key>
<string>kUTTypeMP3</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
<array>
<string>mp3</string>
</array>
</dict>
</dict>
</array>
Pour tout format de fichier standard:
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeName</key>
<string>Unknown File</string>
<key>LSHandlerRank</key>
<string>Alternate</string>
<key>LSItemContentTypes</key>
<array>
<string>public.calendar-event</string>
<string>public.database</string>
<string>public.executable</string>
<string>public.data</string>
<string>public.content </string>
<string>public.item</string>
</array>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>Video</string>
<key>LSHandlerRank</key>
<string>Alternate</string>
<key>LSItemContentTypes</key>
<array>
<string>public.video</string>
</array>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>Image</string>
<key>LSHandlerRank</key>
<string>Alternate</string>
<key>LSItemContentTypes</key>
<array>
<string>public.image</string>
</array>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>Web Archive</string>
<key>LSHandlerRank</key>
<string>Alternate</string>
<key>LSItemContentTypes</key>
<array>
<string>com.Apple.webarchive</string>
</array>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>iWork Keynote</string>
<key>LSHandlerRank</key>
<string>Alternate</string>
<key>LSItemContentTypes</key>
<array>
<string>com.Apple.keynote.key</string>
<string>com.Apple.iWork.keynote.key</string>
<string>com.Apple.iWork.keynote.kth</string>
</array>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>iWork Numbers</string>
<key>LSHandlerRank</key>
<string>Alternate</string>
<key>LSItemContentTypes</key>
<array>
<string>com.Apple.numbers.numbers</string>
<string>com.Apple.iWork.numbers.numbers</string>
<string>com.Apple.iWork.numbers.template</string>
</array>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>iWork Pages</string>
<key>LSHandlerRank</key>
<string>Alternate</string>
<key>LSItemContentTypes</key>
<array>
<string>com.Apple.page.pages</string>
<string>com.Apple.iWork.pages.pages</string>
<string>com.Apple.iWork.pages.template</string>
</array>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>OpenDocument Spreadsheet</string>
<key>LSHandlerRank</key>
<string>Alternate</string>
<key>LSItemContentTypes</key>
<array>
<string>org.oasis.opendocument.spreadsheet</string>
</array>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>OpenDocument Presentation</string>
<key>LSHandlerRank</key>
<string>Alternate</string>
<key>LSItemContentTypes</key>
<array>
<string>org.oasis.opendocument.presentation</string>
</array>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>OpenDocument Text</string>
<key>LSHandlerRank</key>
<string>Alternate</string>
<key>LSItemContentTypes</key>
<array>
<string>org.oasis.opendocument.text</string>
</array>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>Folder</string>
<key>LSHandlerRank</key>
<string>Alternate</string>
<key>LSItemContentTypes</key>
<array>
<string>public.folder</string>
</array>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>Audio</string>
<key>LSHandlerRank</key>
<string>Alternate</string>
<key>LSItemContentTypes</key>
<array>
<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>Movie</string>
<key>LSHandlerRank</key>
<string>Alternate</string>
<key>LSItemContentTypes</key>
<array>
<string>public.movie</string>
<string>public.3gpp2</string>
<string>public.3gpp</string>
<string>public.mpeg</string>
<string>com.Apple.quicktime-movie</string>
<string>public.mpeg-4</string>
</array>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>GIF image</string>
<key>LSHandlerRank</key>
<string>Alternate</string>
<key>LSItemContentTypes</key>
<array>
<string>com.compuserve.gif</string>
</array>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>PNG image</string>
<key>LSHandlerRank</key>
<string>Alternate</string>
<key>LSItemContentTypes</key>
<array>
<string>public.png</string>
</array>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>TIFF image</string>
<key>LSHandlerRank</key>
<string>Alternate</string>
<key>LSItemContentTypes</key>
<array>
<string>public.tiff</string>
</array>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>JPEG image</string>
<key>LSHandlerRank</key>
<string>Alternate</string>
<key>LSItemContentTypes</key>
<array>
<string>public.jpeg</string>
</array>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>XML</string>
<key>LSHandlerRank</key>
<string>Alternate</string>
<key>LSItemContentTypes</key>
<array>
<string>public.xml</string>
</array>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>HTML</string>
<key>LSHandlerRank</key>
<string>Alternate</string>
<key>LSItemContentTypes</key>
<array>
<string>public.html</string>
<string>public.xhtml</string>
</array>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>Rich Text</string>
<key>LSHandlerRank</key>
<string>Alternate</string>
<key>LSItemContentTypes</key>
<array>
<string>public.rtf</string>
<string>com.Apple.rtfd</string>
<string>com.Apple.flat-rtfd</string>
</array>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>Text</string>
<key>LSHandlerRank</key>
<string>Alternate</string>
<key>LSItemContentTypes</key>
<array>
<string>public.text</string>
<string>public.plain-text</string>
<string>public.utf8-plain-text</string>
<string>public.utf16-external-plain-text</string>
<string>public.utf16-plain-text</string>
<string>com.Apple.traditional-mac-plain-text</string>
<string>public.source-code</string>
<string>public.c-source</string>
<string>public.objective-c-source</string>
<string>public.c-plus-plus-source</string>
<string>public.objective-c-plus-plus-source</string>
<string>public.c-header</string>
<string>public.c-plus-plus-header</string>
<string>com.Sun.Java-source</string>
<string>public.script</string>
<string>public.Shell-script</string>
</array>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>Zip</string>
<string>zipx</string>
</array>
<key>CFBundleTypeName</key>
<string>Zip archive</string>
<key>LSHandlerRank</key>
<string>Alternate</string>
<key>LSItemContentTypes</key>
<array>
<string>public.Zip-archive</string>
<string>public.archive</string>
<string>com.pkware.Zip-archive</string>
<string>com.pkware.zipx-archive</string>
</array>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>rar</string>
<string>RAR</string>
</array>
<key>CFBundleTypeName</key>
<string>Rar archive</string>
<key>LSHandlerRank</key>
<string>Alternate</string>
<key>LSItemContentTypes</key>
<array>
<string>com.rarlab.rar-archive</string>
<string>public.archive</string>
</array>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>7z</string>
<string>7Z</string>
</array>
<key>CFBundleTypeName</key>
<string>7z archive</string>
<key>LSHandlerRank</key>
<string>Alternate</string>
<key>LSItemContentTypes</key>
<array>
<string>org.7-Zip.7-Zip-archive</string>
<string>public.archive</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>
<dict>
<key>CFBundleTypeName</key>
<string>Windows icon image</string>
<key>LSHandlerRank</key>
<string>Alternate</string>
<key>LSItemContentTypes</key>
<array>
<string>com.Microsoft.ico</string>
<string>com.Apple.icns</string>
</array>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>Windows bitmap image</string>
<key>LSHandlerRank</key>
<string>Alternate</string>
<key>LSItemContentTypes</key>
<array>
<string>com.Microsoft.bmp</string>
</array>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>Microsoft PowerPoint</string>
<key>LSHandlerRank</key>
<string>Alternate</string>
<key>LSItemContentTypes</key>
<array>
<string>com.Microsoft.PowerPoint.ppt</string>
<string>org.openxmlformats.presentationml.presentation</string>
</array>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>Microsoft Excel</string>
<key>LSHandlerRank</key>
<string>Alternate</string>
<key>LSItemContentTypes</key>
<array>
<string>org.openxmlformats.spreadsheetml.sheet</string>
<string>com.Microsoft.Excel.xls</string>
</array>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>Microsoft Word</string>
<key>LSHandlerRank</key>
<string>Alternate</string>
<key>LSItemContentTypes</key>
<array>
<string>com.Microsoft.Word.doc</string>
<string>com.Microsoft.Word.wordml</string>
<string>org.openxmlformats.wordprocessingml.document</string>
</array>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>PDF</string>
<key>LSHandlerRank</key>
<string>Alternate</string>
<key>LSItemContentTypes</key>
<array>
<string>com.Adobe.pdf</string>
</array>
</dict>
</array>
Vous devriez utiliser Alternate
au lieu de Alternative
<key>LSHandlerRank</key>
<string>Alternate</string>
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>"*"</string>
</array>
<key>CFBundleTypeName</key>
<string>Unknown</string>
<key>LSItemContentTypes</key>
<array>
<string>public.data</string>
</array>
</dict>
</array>