首页 文章

使用“com.instagram.photo”UTI从UIDocumentInteractionController获取图像

提问于
浏览
0

我正在尝试将图像发送到我的应用中的Instagram,就像许多照片应用程序正在做这些天 . 我从UIDocumentInteractionController导入了一些关于导入文档的教程,但是它没有用 .

也许因为所有教程都是关于如何打开PDF文件,以及打开发送到Instagram的.ig文件我需要更多的东西?

无论如何,我编辑了我的plist以添加以下行:

<key>CFBundleDocumentTypes</key>
<array>
    <dict>
        <key>LSItemContentTypes</key>
        <array>
            <string>com.instagram.photo</string>
        </array>
        <key>CFBundleTypeRole</key>
        <string>Viewer</string>
        <key>CFBundleTypeName</key>
        <string>Ig Document</string>
        <key>LSHandlerRank</key>
        <string>Default</string>
    </dict>
</array>

现在我的应用程序出现在UIDocumentInteractionController菜单中,但是当我点击“在MyPhotoApp中打开”时,菜单才关闭,没有任何反应 .

我试着在方法中设置一个断点:(BOOL)应用程序:(UIApplication *)应用程序openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation

但它似乎从未被称为 . 我错过了什么?

1 回答

  • 0

    好的,想通了 . 我在plist上遗漏了以下几行:

    <key>UTExportedTypeDeclarations</key>
    <array>
        <dict>
           <key>UTTypeTagSpecification</key>
           <dict>
               <key>public.filename-extension</key>
               <string>ig</string>
           </dict>
           <key>UTTypeIdentifier</key>
           <string>com.instagram.photo</string>
           <key>UTTypeDescription</key>
           <string>Ig Photo</string>
       </dict>
    </array>
    

    现在它正在运作

相关问题