Custom file types with iOS Document Interaction Programming

I understand the basic Document Interaction Programming and UIDocumentInteractionController software, and it works for me in my application. However, I am having problems with the specific details of using custom file types. I cannot find this in Apple docs anywhere.

My application uses its own file types with unique extensions. The files themselves are just plists (xml), but I want the device to treat files as opened only in my application. I originally implemented Document Interaction material to treat them as XML while I work, but now I want it to treat them as binary files that it needs to pass to my application.

At the moment, if you have one of my files in an email application, iOS first displays QuickLook (which simply displays all the textual content xml out) before you can select Open In. Similarly, if one of my files is opened using Safari, Safari simply displays the XML and does not give you the opportunity to display it in my application at all.

So, how do I get iOS to not treat my files as XML? I changed the value of "Conforms to UTI" and the value of "public.mime-type" in the info.plist file, but it seems to have no effect.

Any advice is greatly appreciated.

+4
source share
1 answer

As I understand the concept of Apple UIT, you cannot just change the file extension to change the potential UIT of a file. If the file contains XML data, other applications, as well as internal applications, can recognize your content and display it internally as XML.

Try saving Plists with NSPropertyListSerialization NSPropertyListBinaryFormat_v1_0 (then you read the XML)

When you did this without success, why not try this:

  • use zlib to compress the XML arrays after that to an archived file.
  • create "unique" file extensions ( <file> .myappname)

this should β€œhide” other applications and quick browsing.

Tell me if one of the ways worked for you.

0
source

Source: https://habr.com/ru/post/1392849/


All Articles