2017-10-06 37 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>