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

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.