1

My app is stuck at iOS 13 for the time being, and I can't get the UIDocumentPickerViewController only to allow the selection of binary files.

This is what I'm putting into my info.plist

<key>UTExportedTypeDeclarations</key>
<array>
    <dict>
        <key>UTTypeIdentifier</key>
        <string>public.firmware</string>
        <key>UTTypeDescription</key>
        <string>Firmware Binary</string>
        <key>UTTypeIconFile</key>
        <string></string>
        <key>UTTypeConformsTo</key>
        <array>
            <string>public.data</string>
        </array>
        <key>UTTypeIconFiles</key>
        <array/>
        <key>UTTypeTagSpecification</key>
        <dict>
            <key>public.filename-extension</key>
            <array>
                <string>bin</string>
            </array>
            <key>public.mime-type</key>
            <string>application/octet-stream</string>
        </dict>
    </dict>
</array>

Here's what I'm hooking up to a button upon selection

let vc = UIDocumentPickerViewController(documentTypes: ["public.firmware"], in: .import)
    vc.delegate = self
    
    self.present(vc, animated: true)

I'd use UTType but it's not available in iOS 13. Also, I'm not sure if I'm using the correct mime-type. I chose octet-stream from this list https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types

Yogurt
  • 2,913
  • 2
  • 32
  • 63

1 Answers1

0

What is your goal exactly? Allow selecting files with the file extension .bin?

The .bin tag is already claimed by com.apple.macbinary-archive, so to do that you should avoid redeclaring your own type and just use that Apple-provided type directly.

Thomas Deniau
  • 2,488
  • 1
  • 15
  • 15