Paulo Cesar
Paulo Cesar

Reputation: 2268

Get image from UIDocumentInteractionController with "com.instagram.photo" UTI

I'm trying to get images sent to instagram in my app, like many photo apps are doing these days. I followed some tutorials on importing document from UIDocumentInteractionController, but it's not working.

Maybe because all tutorials are on how to open PDF files, and to open the .ig files that are sent to instagram I need something more?

Anyway, I edited my plist to add the following lines:

<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>

And now my app appears in the UIDocumentInteractionController menu, but when I click on "Open in MyPhotoApp", the menu just closes, and nothing happens.

I'm tried putting a break point in the method: (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation

But it appears that it's never called. What am I missing?

Upvotes: 0

Views: 526

Answers (1)

Paulo Cesar
Paulo Cesar

Reputation: 2268

Ok, figured out. I was missing the following lines on my 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>

Now it's working

Upvotes: 0

Related Questions