2012-07-17 65 views
1

我試圖做出會通過長按>打開「我的應用」副音頻和視頻類型與iPhone應用程序

我有麻煩關聯的文件類型從郵件應用程序接收媒體文件的應用程序我想用我的應用程序。我現在用的是Uniform Type Identifiers Reference

這是我的info.plist的樣子:

<key>CFBundleDocumentTypes</key> 
<array> 
    <dict> 
     <key>CFBundleTypeExtensions</key> 
     <array> 
      <string>mp3</string> 
     </array> 
     <key>CFBundleTypeName</key> 
     <string>MP3 Audio</string> 
     <key>CFBundleTypeRole</key> 
     <string>Viewer</string> 
     <key>LSHandlerRank</key> 
     <string>Alternate</string> 
     <key>LSItemContentTypes</key> 
     <array> 
      <string>public.mp3</string> 
     </array> 
     <key>LSTypeIsPackage</key> 
     <false/> 
    </dict> 
    <dict> 
     <key>CFBundleTypeExtensions</key> 
     <array> 
      <string>avi</string> 
     </array> 
     <key>CFBundleTypeName</key> 
     <string>AVI movie</string> 
     <key>LSHandlerRank</key> 
     <string>Alternate</string> 
     <key>CFBundleTypeRole</key> 
     <string>Viewer</string> 
     <key>LSItemContentTypes</key> 
     <array> 
      <string>public.avi</string> 
      <string>video/x-msvideo</string> 
     </array> 
     <key>LSTypeIsPackage</key> 
     <false/> 
    </dict> 
    <dict> 
     <key>CFBundleTypeExtensions</key> 
     <array> 
      <string>3gp</string> 
     </array> 
     <key>CFBundleTypeName</key> 
     <string>3GPP movie</string> 
     <key>LSHandlerRank</key> 
     <string>Alternate</string> 
     <key>CFBundleTypeRole</key> 
     <string>Viewer</string> 
     <key>LSItemContentTypes</key> 
     <array> 
      <string>public.3gpp</string> 
      <string>application/octet-stream</string> 
     </array> 
     <key>LSTypeIsPackage</key> 
     <false/> 
    </dict> 
    <dict> 
     <key>CFBundleTypeExtensions</key> 
     <array> 
      <string>mpg4</string> 
      <string>mp4</string> 
      <string>m4v</string> 
     </array> 
     <key>CFBundleTypeName</key> 
     <string>MPEG-4 content</string> 
     <key>LSHandlerRank</key> 
     <string>Alternate</string> 
     <key>CFBundleTypeRole</key> 
     <string>Viewer</string> 
     <key>LSItemContentTypes</key> 
     <array> 
      <string>public.mpeg-4</string> 
      <string>video/mp4</string> 
      <string>video/mp4v</string> 
     </array> 
     <key>LSTypeIsPackage</key> 
     <false/> 
    </dict> 
    <dict> 
     <key>CFBundleTypeExtensions</key> 
     <array> 
      <string>mov</string> 
     </array> 
     <key>CFBundleTypeName</key> 
     <string>QuickTime movie</string> 
     <key>LSHandlerRank</key> 
     <string>Alternate</string> 
     <key>CFBundleTypeRole</key> 
     <string>Viewer</string> 
     <key>LSItemContentTypes</key> 
     <array> 
      <string>com.apple.quicktime-movie</string> 
      <string>video/quicktime</string> 
     </array> 
     <key>LSTypeIsPackage</key> 
     <false/> 
    </dict> 
</array> 

這些中,僅支持MP3和AVI顯示打開在「我的應用程序」選項。我只是獲得了「保存視頻」選項,將視頻添加到我的相機膠捲上。我究竟做錯了什麼?

我想關聯的格式是:AVI,3GP,MP4,M4V,MOV。

我也試過這個。它適用於MP3,WAV,AVI,FLV,但仍然沒有去爲3GP,MP4,MOV,M4V

<key>CFBundleDocumentTypes</key> 
<array> 
    <dict> 
     <key>CFBundleTypeName</key> 
     <string>Audio</string> 
     <key>CFBundleTypeRole</key> 
     <string>Editor</string> 
     <key>LSItemContentTypes</key> 
     <array> 
      <string>public.audio</string> 
     </array> 
    </dict> 
    <dict> 
     <key>CFBundleTypeName</key> 
     <string>Video</string> 
     <key>CFBundleTypeRole</key> 
     <string>Editor</string> 
     <key>LSItemContentTypes</key> 
     <array> 
      <string>public.movie</string> 
     </array> 
    </dict> 
</array> 

回答

0

我已經安裝了其他支持文件導入的應用程序(例如TeamViewer,oPlayer等)。它們也不會顯示在MOV,3GP,M4V等郵件應用程序的「打開爲...」操作表中。

我猜測,蘋果不允許某些文件被第三方應用程序打開,並希望它們在內部處理。所以用戶可以做的就是將它們保存到相機膠捲。

剩下的唯一選擇是向我們的應用添加功能,以允許從相機膠捲中選擇視頻。因此,郵件>保存視頻>相機膠捲>第三方應用程序

真是無賴。

我在信息中的最終條目。plist

<key>CFBundleDocumentTypes</key> 
<array> 
    <dict> 
     <key>CFBundleTypeName</key> 
     <string>Audio</string> 
     <key>CFBundleTypeRole</key> 
     <string>Viewer</string> 
     <key>LSHandlerRank</key> 
     <string>Alternate</string> 
     <key>LSItemContentTypes</key> 
     <array> 
      <string>public.audio</string> 
     </array> 
    </dict> 
    <dict> 
     <key>CFBundleTypeName</key> 
     <string>Video</string> 
     <key>CFBundleTypeRole</key> 
     <string>Viewer</string> 
     <key>LSHandlerRank</key> 
     <string>Alternate</string> 
     <key>LSItemContentTypes</key> 
     <array> 
      <string>public.3gpp</string> 
      <string>public.3gpp2</string> 
      <string>public.mpeg-4</string> 
      <string>public.avi</string> 
      <string>com.apple.quicktime-movie</string> 
      <string>public.mpeg</string> 
      <string>public.movie</string> 
     </array> 
    </dict> 
</array> 

我仍然希望有一些解決這個問題..任何人?

3

SO回答How do I associate file types with an iPhone application?,顯示一些例子,不同於您也非常小。這個文件的內容看起來像它應該工作,雖然有一些冗餘根據文檔:

  • CFBundleTypeExtensionsMacOS而已,即使如此,它是 多餘的,如果忽略LSItemContentTypes存在。
  • LSTypeIsPackage只有MacOS,即使如此,它是多餘的 並且如果存在LSItemContentTypes則被忽略。
  • 本文檔建議使用統一類型標識符 CFBundleTypeName。例如對於MP4,而不是使用MPEG-4的內容 你有,而是嘗試public.mpeg-4(內部kUTTypeMPEG4)

依然,而我認爲清理將是一個不錯的主意,我覺得只有這些最後一個可能有解決你的問題的真正機會,因爲其他兩個應該被忽略。

......這意味着我認爲可能實際上解決您的問題是清理您的應用程序關閉設備,離開緩存,退出xcode,然後重新打開您的項目,重新構建並再次運行它。在將資源放在設備上時,我遇到了Xcode及其部署機制混淆的問題。如果在開始註冊之前嘗試進行清理,可能會將事情弄清楚,直到您達到此目的爲止。

+0

我試過了你的想法,但它不起作用。我不明白打開在郵件app.I 「我的應用」 選項一起使用:\t \t \t \t \t CFBundleTypeName \t \t \t MP4 \t \t \t CFBundleTypeRole \t \t \t 瀏覽器 \t \t \t 個LSItemContentTypes \t \t \t \t \t \t \t public.mpeg -4- \t \t \t \t \t 2012-07-22 11:12:14

+0

其他職位中的一個顯示 CFBundleTypeName public.mpeg-4用於該位定義。我的閱讀不是必需的,我已經看到其他例子像你的那樣設置,但是如在最後一個項目符號中那樣,該名稱可能在該插槽中是必需的。 – 2012-07-22 16:59:44

+0

:(仍然does not工作:\t \t \t \t \t CFBundleTypeName \t \t \t public.mpeg-4 \t \t \t CFBundleTypeRole \t \t \t 瀏覽器 \t \t \t LSHandlerRank \t \t \t 替代 \t \t \t LSItemContentTypes \t \t \t \t \t \t \t public.mpeg -4- \t \t \t \t \t ..我嘗試過兩個電話和兩個mac! – 2012-07-23 07:55:04