Why can't I register my iOS application to handle the image file type?

后端 未结 7 752
你的背包
你的背包 2020-12-10 03:40

I have a problem registering image file types to my application. I tried adding the code below to my plist but nothing happens.

CFBundleDocumentTy         


        
相关标签:
7条回答
  • 2020-12-10 03:47

    It is now possible to open images from the mail app in iOS 7, it's just somewhat convoluted:

    Tap and hold the image. Tap on Quick Look so the image goes fullscreen. Tap the image to show the top toolbar. Tap the open in button at the top right. Scroll the list to the left to find your app.

    Be sure to set up your bundle document types for the image types you are interested in.

    0 讨论(0)
  • 2020-12-10 03:50

    Try:

    <key>CFBundleDocumentTypes</key>
        <array>
            <dict>
                <key>CFBundleTypeName</key>
                <string>Scary Bug Document</string>
                <key>LSHandlerRank</key>
                <string>Alternate</string>
                <key>CFBundleTypeRole</key>
                <string>None</string>
                <key>LSItemContentTypes</key>
                <array>
                    <string>public.png</string>
                    <string>public.jpg</string>
                </array>
            </dict>
        </array>
    

    Also, see this other answer on StackOverflow

    0 讨论(0)
  • 2020-12-10 03:53

    After doing a bit of research it seems that is not possible to register the app for images. Thanks for your answers.

    0 讨论(0)
  • 2020-12-10 03:58

    Dimitri Bouniol response that it works in iOS 7 via quick look is correct. The following additions to my in info.plist below are how I got it to work for my app. Still have not figured out how to get share in photos or camera roll to work.

      <key>CFBundleDocumentTypes</key>
        <array>
            <dict>
                <key>CFBundleTypeExtensions</key>
                <array>
                    <string>myapp image</string>
                </array>
                <key>CFBundleTypeName</key>
                <string>public.png</string>
                <key>CFBundleTypeRole</key>
                <string>Editor</string>
                <key>LSHandlerRank</key>
                <string>Alternate</string>
                <key>LSItemContentTypes</key>
                <array>
                    <string>public.png</string>
                    <string>public.jpeg</string>
                </array>
            </dict>
        </array>
        <key>UTImportedTypeDeclarations</key>
        <array>
            <dict>
                <key>UTTypeConformsTo</key>
                <array>
                    <string>public.image</string>
                </array>
                <key>UTTypeIdentifier</key>
                <string>public.png</string>
                <key>UTTypeTagSpecification</key>
                <dict>
                    <key>com.apple.ostype</key>
                    <string>PNG</string>
                    <key>public.filename-extension</key>
                    <array>
                        <string>png</string>
                    </array>
                    <key>public.mime-type</key>
                    <string>image/png</string>
                </dict>
            </dict>
            <dict>
                <key>UTTypeIdentifier</key>
                <string>public.jpeg</string>
                <key>UTTypeReferenceURL</key>
                <string>http://www.w3.org/Graphics/JPEG/</string>
                <key>UTTypeDescription</key>
                <string>JPEG image</string>
                <key>UTTypeIconFile</key>
                <string>public.jpeg.icns</string>
                <key>UTTypeConformsTo</key>
                <array>
                    <string>public.image</string>
                    <string>public.data</string>
                </array>
                <key>UTTypeTagSpecification</key>
                <dict>
                    <key>com.apple.ostype</key>
                    <string>JPEG</string>
                    <key>public.filename-extension</key>
                    <array>
                        <string>jpeg</string>
                        <string>jpg</string>
                    </array>
                    <key>public.mime-type</key>
                    <string>image/jpeg</string>
                </dict>
            </dict>
        </array>
    
    0 讨论(0)
  • 2020-12-10 03:58

    public.image is an abstract type, try registering for public.png or public.jpeg etc

    0 讨论(0)
  • 2020-12-10 04:05

    OS will not allow you to open images in your app. I also tried myself a lot of permutation & combination, and confirmed from a few more posts in Apple Support.

    0 讨论(0)
提交回复
热议问题