How to import a file with a custom file type into an app from the web?

I have created a custom file type for my app, that conforms to XML. Now I am trying to find a way so that users can share the file online and import it from there into the app.

I have added an UTExportedTypeDeclarations and CFBundleDocumentTypes for my custom type to info.plist, and also added LSSupportsOpeningDocumentsInPlace and UIFileSharingEnabled.

What works so far is that I can share a file via UIActivityViewController and send by mail, and when I tap the file in the E-Mail, the app opens and imports the file.

But what I haven't managed to get working so far is to import a file from a website. Safari will automatically detect that it is an XML file, ignore my own file extension and show the file in Safari. As XML.

The only way to get the file open in the app is if I long-press a link to a file, then tap on "Download linked file". This will send the file to the downloads folder and add ".xml" to the downloaded file. Now if I also add "public.xml" to LSItemContentTypes, it will open the file in the app. But this is of course not very user friendly, and it will open any XML-files in my app, which is not what I want.

Is there any other way on iOS that users can share app files online and directly import them into an app? Or am I missing a setting somewhere?

Here an example of how my CFBundleDocumentTypes is set up:

<key>CFBundleDocumentTypes</key>
    <array>
      <dict>
        <key>CFBundleTypeName</key>
        <string>My own project file</string>
        <key>LSHandlerRank</key>
        <string>Owner</string>
        <key>LSItemContentTypes</key>
        <array>
          <string>com.mycompany.myfiletype</string>
          <string>public.xml</string>
        </array>
      </dict>
    </array>

And the exported UTExportedTypeDeclarations:

<key>UTExportedTypeDeclarations</key>
    <array>
      <dict>
        <key>UTTypeConformsTo</key>
        <array>
          <string>public.xml</string>
        </array>
        <key>UTTypeDescription</key>
        <string>My own project file</string>
        <key>UTTypeIconFiles</key>
        <array />
        <key>UTTypeIdentifier</key>
        <string>com.mycompany.myfiletype</string>
        <key>UTTypeTagSpecification</key>
        <dict>
          <key>public.filename-extension</key>
          <array>
            <string>myfiletype</string>
          </array>
        </dict>
      </dict>
    </array>
How to import a file with a custom file type into an app from the web?
 
 
Q