Reading a custom UTType file from iCloud

I have a requirement to download a custom file type into my app from iCloud. Let's say that the extension for this file is .abc

In my app I use UIDocumentMenuViewController to open up iCloud Drive, which is working correctly. I have added a custom UTType to my info.plist so I am able to select my .abc file. However, when I select the file, my DidPickDocument handler returns that the file doesn't exist.

File.Exists(args.Url.Path) // returns false for my custom file type
This is not an issue with a .txt file in the same iCloud Drive, only my custom file type.

Am I missing a step in my setup to handle custom file types?

My Exported UTI is below:

UTExportedTypeDeclarations


UTTypeIdentifier
public.abc
UTTypeDescription
My Custom File
UTTypeIconFile
public.jpeg.icns
UTTypeConformsTo

public.data

UTTypeTagSpecification

com.apple.ostype
ABC
public.filename-extension

abc


CFBundleTypeName
ABC

My Document Type is:

CFBundleDocumentTypes


CFBundleTypeName
ABC Configuration FIle
LSItemContentTypes

public.abc

CFBundleTypeIconFiles

[email protected]


Posts

  • GirirajKulkarniGirirajKulkarni USMember ✭✭
    void DidPickDocumentForImport (object sender, UIDocumentPickedEventArgs e)
        {
            // The url refers to a copy of the selected document.
            // This document is a temporary file.
            // It remains available only until your application terminates.
            // To keep a permanent copy, you must move this file to a permanent location inside your sandbox.
            NSUrl temporaryFileUrl = e.Url;
            var securityScopedUrl = e.Url;
            string fname = e.Url.Path;
            Stream bob = new FileStream(fname, FileMode.Open, FileAccess.Read);
    
        }
    
Sign In or Register to comment.