2017-10-06 28 views
0

我有我已经和ZIP文件,像这样关联的iOS应用:副MP3与iOS应用,“打开方式...”

<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> 

而这按预期工作。当用户点击一个ZIP在Safari中下载时,我的应用程序将作为一个应用程序来“打开”。


我想要MP3的相同功能。我试过以下无效(应用程序不在列表中)。我也试过微妙的变化:

<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> 

此图片概括了我要去为:

enter image description here

有MP3文件的“保护”还是什么?我需要一种方式让用户能够在我的iOS应用程序中下载/访问MP3文件(用作音效)。

令人惊讶的是,搜索是空的。理想情况下,在他们的应用中发布其info.plist的MP3功能的用户会非常有帮助。

回答

0

为什么您的mp3设置与您的zip设置不同?以下修补程序应该可以工作:

<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>