From 3b7b6a014b5f705bb9f64a1d43feceba5cdcbf5e Mon Sep 17 00:00:00 2001 From: Riley Testut Date: Fri, 20 Mar 2020 15:36:37 -0700 Subject: [PATCH] Fixes grayed-out .ipas due to duplicate UTI declarations --- AltStore/My Apps/MyAppsViewController.swift | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/AltStore/My Apps/MyAppsViewController.swift b/AltStore/My Apps/MyAppsViewController.swift index 4193ad4e..e15cd242 100644 --- a/AltStore/My Apps/MyAppsViewController.swift +++ b/AltStore/My Apps/MyAppsViewController.swift @@ -7,6 +7,7 @@ // import UIKit +import MobileCoreServices import AltKit import Roxas @@ -649,9 +650,18 @@ private extension MyAppsViewController self.presentSideloadingAlert { (shouldContinue) in guard shouldContinue else { return } - let iOSAppUTI = "com.apple.itunes.ipa" // Declared by the system. + let supportedTypes: [String] - let documentPickerViewController = UIDocumentPickerViewController(documentTypes: [iOSAppUTI], in: .import) + if let types = UTTypeCreateAllIdentifiersForTag(kUTTagClassFilenameExtension, "ipa" as CFString, nil)?.takeRetainedValue() + { + supportedTypes = (types as NSArray).map { $0 as! String } + } + else + { + supportedTypes = ["com.apple.itunes.ipa"] // Declared by the system. + } + + let documentPickerViewController = UIDocumentPickerViewController(documentTypes: supportedTypes, in: .import) documentPickerViewController.delegate = self self.present(documentPickerViewController, animated: true, completion: nil) }