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

hippietrail
  • 15,848
  • 18
  • 99
  • 158
Kenny
  • 11
  • 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 ( https://gist.github.com/rmorey/b8d1b848086bdce026a9f57732a3b858?cmdf=com.android.package-archive+uniform+type+identifier ) – Thomas Deniau Jun 20 '23 at 07:37

0 Answers0