【问题标题】:Get image from UIDocumentInteractionController with "com.instagram.photo" UTI使用“com.instagram.photo”UTI 从 UIDocumentInteractionController 获取图像
【发布时间】:2013-06-24 21:55:45
【问题描述】:

我正在尝试在我的应用中将图片发送到 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)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation

但它似乎从未被调用过。我错过了什么?

【问题讨论】:

    标签: objective-c instagram


    【解决方案1】:

    好的,想通了。我的 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>
    

    现在可以了

    【讨论】:

      猜你喜欢
      • 2012-01-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-01-05
      • 1970-01-01
      • 2012-09-16
      相关资源
      最近更新 更多