1

I have a UIDocumentPickerViewController with the following code:

if #available(iOS 14.0, *) {
    let apkType = UTType("com.coocaa.apk")
    let docPickerVC = UIDocumentPickerViewController(forOpeningContentTypes: [apkType!])
    docPickerVC.delegate = self
    present(docPickerVC, animated: true)
} else {
    let types = ["com.coocaa.apk"]
    let docPickerVC = UIDocumentPickerViewController(documentTypes: types, in: .open)
    present(docPickerVC, animated: true)
}

I can't pick .apk file in iOS14 or iOS 16.5, But can't pick .apk files in iOS 16.1 The following screenshot shows what a .apk file looks like in the picker:
iOS file picker with APKs
I've added the following to my info.plist file which to my understanding may be needed

<key>UTExportedTypeDeclarations</key>
<key>UTExportedTypeDeclarations</key>
<array>
    <dict>
        <key>UTTypeConformsTo</key>
        <array>
            <string>public.data</string>
            <string>public.archive</string>
        </array>
        <key>UTTypeDescription</key>
        <string>apk statements</string>
        <key>UTTypeIdentifier</key>
        <string>com.coocaa.apk</string>
        <key>UTTypeTagSpecification</key>
        <dict>
            <key>public.filename-extension</key>
            <array>
                <string>apk</string>
            </array>
        </dict>
    </dict>
</array>

What do I need to do to have UIDocumentPickerViewController allow picking .apk file types in all iOS system

1
  • You should not export that type if you do not own that file extension. Import it instead. I do not think it depends on your OS version, but it might depend on the apps you have installed? I have also seen this type declared elsewhere as com.android.package-archive ( gist.github.com/rmorey/… ) Commented Jun 20, 2023 at 7:37

0

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.