IOS: error sending application file to Dropbox using UIDocumentInteractionController

I am working on an iOS application that allows me to export my data via email. The application registers the file type as a file with the "sainputs" extension (this means that the application can also open the file from email or Dropbox to import values ​​- this works fine). I am trying to add the ability to send a file to any other application that can open different types of files. Dropbox is a good example - it is assumed that it can open any type of file.

I'm currently trying to do this by showing a UIDocumentInteractionController that is initialized with the file url. When it is displayed, the Dropbox application appears as one of the available options for opening a file, as expected.

However, when I click the Dropbox icon, nothing happens, and in the console I see the following text:

LaunchServices: Invalid LSOpenOperation request - No applications found to open document 

In the application plist file, it registers a document type having UTI com.mycompany.myapp.sainputs, and it registers an exported UTI type with identifier com.mycompany.myapp.sainputs, with the extension public name 'sainputs' and MIME -type myapp / input.

Here are the relevant excerpts from the plist file:

 <key>CFBundleDocumentTypes</key> <array> <dict> <key>CFBundleTypeName</key> <string>My App File Type</string> <key>LSHandlerRank</key> <string>Owner</string> <key>LSItemContentTypes</key> <array> <string>com.mycompany.myapp.sainputs</string> </array> </dict> <array> . . . <key>UTExportedTypeDeclarations</key> <array> <dict> <key>UTTypeConformsTo</key> <array/> <key>UTTypeDescription</key> <string>My App File Type</string> <key>UTTypeIdentifier</key> <string>com.mycompany.myapp.sainputs</string> <key>UTTypeTagSpecification</key> <dict> <key>public.filename-extension</key> <string>sainputs</string> <key>public.mime-type</key> <string>steuerapp/inputs</string> </dict> </dict> <array> 

I tried changing the MIME type to "application / octet-stream" in the plist file. It didn’t matter.

Any tips / ideas would be highly appreciated.

+6
source share
2 answers

As suggested by @maddy and @bgh, this solves the problem. I just ran into the same problem.

In addition to defining your custom generic type, you can also indicate that this type is a “subtype” of a more general type. For instance. explicitly specifying the UTI 'public.data' in the UTTypeConformsTo key as follows:

 <dict> <key>UTTypeConformsTo</key> <array> <string>public.data</string> </array> <key>UTTypeDescription</key> <string>My App File Type</string> <key>UTTypeIdentifier</key> <string>com.mycompany.myapp.sainputs</string> <key>UTTypeTagSpecification</key> <dict> <key>public.filename-extension</key> <string>sainputs</string> <key>public.mime-type</key> <string>steuerapp/inputs</string> </dict> </dict> 

Then you can specify your custom uti as an argument in the UIDocumentInteractionController:

 UIDocumentInteractionController *documentController = ...; documentController.UTI = @"com.mycompany.myapp.sainputs"; 

Information on this can be found here.

+5
source

If this happens to someone else:

I could not get Klaas to respond because I had a different application on the device (the “light” version) that also declared the same UTI with the wrong settings. You need to add "public.data" to every application that declares a type before it can work.

Just to make sure, I would recommend debugging with only one application installed, and then add another and see if everything works.

0
source

All Articles