我正在尝试打开一个仅允许某些文件类型的选择器。我正在使用此文档来查找我需要的 UTTYpe: https://developer.apple.com/documentation/uniformtypeidentifiers/uttype/system_declared_uniform_type_identifiers
但我找不到 .pages、.doc、.docx 的 UTTYpe...
我应该怎么办?
这是我目前的代码
func presentPickerDocument() {
//Create a picker specifying file type and mode
var supportedTypes: [UTType]
supportedTypes = [UTType.pdf, UTType.url]
let documentPicker = UIDocumentPickerViewController(forOpeningContentTypes: supportedTypes, asCopy: true)
documentPicker.delegate = self
documentPicker.allowsMultipleSelection = false
present(documentPicker, animated: true, completion: nil)
}
Run Code Online (Sandbox Code Playgroud)