Related types of audio and video with iPhone application

I am trying to create an application that will receive multimedia files from the Mail application using Long Press> Open in "My app"

I'm having trouble linking the file types I want with my application. I use Unified Type Identifier Identifier

This is what my info.plist looks like:

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

Of these, only Mp3 and AVI show the Open In "My app" option. I just get the option "Save Video", which adds the video to the camera roll. What am I doing wrong?

The formats I want to link are: AVI, 3GP, MP4, M4V, MOV.

I also tried this. It works for MP3, WAV, AVI, FLV, but still not suitable for 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> 
+1
source share
2 answers

I installed other applications (for example, TeamViewer, oPlayer, etc.) that also support importing documents .. They also do not appear in the "Open As .." action table for the Mail application for MOV, 3GP, M4V and etc.

I assume that the apple does not allow some files to be opened by third-party applications and wants them to be processed internally. Thus, all the user can do is save them in Camera Roll.

It remains only to add the functionality of our applications so that you can select video from the camera’s video. So, Mail> Save Video> Camera Roll> Third-Party Application

What a bummer.

My final entries in Info.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> 

I still hope there is something like that. Is anyone

0
source

SO answer to How to associate file types with an iPhone app? , shows some examples that differ from you only very slightly. the contents of this file look as if it should work, although according to the documentation there are some abbreviations:

  • CFBundleTypeExtensions only MacOS , and even then it is redundant and ignored if LSItemContentTypes present.
  • LSTypeIsPackage MacOS only, and even then it is redundant and ignored if LSItemContentTypes present.
  • The documentation recommends using a uniform type identifier for CFBundleTypeName . e.g. for mp4, instead of using MPEG-4 content, try public.mpeg-4 instead (internally kUTTypeMPEG4)

still, although I think cleaning is a good idea, I think that only the last one can have a real chance to solve your problem, because the other two should just be ignored.

..., which means that, in my opinion, it can solve your problem - clearing your application from the device and from the cache, exiting xcode, and then reopening your project, re-building and starting it again. I had problems when Xcode and its deployment mechanism got confused when placing resources on the device. Performing this cleanup can correct the situation if some kind of registration attempt first failed before you reached this point.

+3
source

Source: https://habr.com/ru/post/954573/


All Articles