IOS 8在我的应用程序中从其他应用程序打开图像
我做了一些研究,但似乎仍然没有运气
当我在info.plist中添加这些xml时
UTImportedTypeDeclarations UTTypeConformsTo public.data UTTypeIdentifier my.custom.uti UTTypeDescription PDF file CFBundleDocumentTypes LSItemContentTypes public.data CFBundleTypeIconFile Icon.png CFBundleTypeRole Editor CFBundleTypeName my.custom.uti LSHandlerRank Alternate
我发了3封电子邮件给自己。 1 – pdf文件。 2 – png文件。 3 – jpg和png文件。
当我添加这些xmls时,我的应用程序可以在pdf和txt文件中显示,当点击“打开…”但我想要的是在图像中打开。 什么出错? 并设置UITTypeConformsTo = public.data,假设它是一般值。 所以我的应用程序可以打开所有格式(至少pdf和图像),但似乎不。
我也尝试将此答案中的xml复制到我的info.plist https://stackoverflow.com/a/11609935/1061074仍然没有运气
在我的应用程序中,我不使用关键的UTImportedTypeDeclarations。 您可以删除它并尝试使用以下内容:
CFBundleDocumentTypes CFBundleTypeName Image LSHandlerRank Alternate LSItemContentTypes public.image CFBundleTypeName OpenDocument Text LSHandlerRank Alternate LSItemContentTypes org.oasis.opendocument.text CFBundleTypeName GIF image LSHandlerRank Alternate LSItemContentTypes com.compuserve.gif CFBundleTypeName PNG image LSHandlerRank Alternate LSItemContentTypes public.png CFBundleTypeName TIFF image LSHandlerRank Alternate LSItemContentTypes public.tiff CFBundleTypeName JPEG image LSHandlerRank Alternate LSItemContentTypes public.jpeg CFBundleTypeName Rich Text LSHandlerRank Alternate LSItemContentTypes public.rtf com.apple.rtfd com.apple.flat-rtfd CFBundleTypeName Text LSHandlerRank Alternate LSItemContentTypes public.text public.plain-text public.utf8-plain-text public.utf16-external-plain-text public.utf16-plain-text com.apple.traditional-mac-plain-text public.source-code public.c-source public.objective-c-source public.c-plus-plus-source public.objective-c-plus-plus-source public.c-header public.c-plus-plus-header com.sun.java-source public.script public.shell-script CFBundleTypeName PDF LSHandlerRank Alternate LSItemContentTypes com.adobe.pdf
这完全取决于主机应用程序中“共享”按钮的实现方式。 在iOS8中,实际上有两种不同的方法:(1)在Info.plist中使用CFBundleDocumentTypes,以及(2)应用程序扩展。 一些应用程序,如GMail和AVR支持(1)和(2)。 但Dropbox仅支持(2)。 这就是为什么CFBundleDocumentTypes不再适用于Dropbox的原因。 当然,事情可能会在以后发生变化。