Forum General

Register iOS app to open an image from the photo library (PhotoKit) and all other apps.

MedFehmiMedFehmi Member ✭✭
edited July 2020 in General

Hi fellows :smile:

I have been struggling with this for a few hours and couldn't confirm wether the following scenario is possible to achieve anymore or not.

Scenario : I am developing an app that deals (create, store ...) with files (image, video, pdf ..) and want to expose it as a viewer for these type of files to any other app in the device and mainly the photo library.

Current behaviour : my app is visible (and of course handling the files) when hit sharing from files browser on iPhone, google drive, one drive ... except the photo library. The only possible way I found to make it visible there is through creating a Share Extension which does not serve what I am attending to do since it is a limitation that Share Extension can not communicate with the app and attend to open it and pass the image path (or stream).

Here is my info.plist CFBundleDocumentTypes :

<key>CFBundleDocumentTypes</key>
    <array>
        <dict>
            <key>CFBundleTypeName</key>
            <string>CFBundleTypeName</string>
            <key>LSItemContentTypes</key>
            <array>
                <string>public.data</string>
            </array>
        </dict>
    </array>

All I found so far is you just need CFBundleDocumentTypes to register your app in the device target apps for opening certain files (by types indicated by LSItemContentTypes). But no one has mentioned (I couldn't find one yet at least), why this sort of config won't get your app visible as a viewer when selecting share photo from photos library.

To Reproduce : just create a native iOS project via XCode or Xamarin.iOS project and introduce the above section into your info.plist. And of course run your app. You'll see it from files explorer, from safari trying to share a pdf to your file..., but not from photos library.

Tagged:
Sign In or Register to comment.