问题描述
我有一个 xamarin 应用程序,我正在使用 Essential File Picker 从库中选择文件。我正在尝试找到一种方法来为 IOS 定义 doc 和 docx 文件,但我没有做对。 对于Android,我得到了它。 下面是我用过的代码。
`
private List<string> androidAcceptableList = new List<string> { "application/pdf","image/*" }; //Todo:Read from configuration
private List<string> iOsAcceptableList = new List<string> { "application/pdf","application/msword","application/vnd.openxmlformats-officedocument.wordprocessingml.document","image/*"}; //Todo:Read from configuration
var customFileTypes = new FilePickerFileType(new Dictionary<DevicePlatform,IEnumerable<string>> {
{ DevicePlatform.iOS,iOsAcceptableList },{ DevicePlatform.Android,androidAcceptableList}
});
var resp = FilePicker.PickAsync(new PickOptions { FileTypes = FileTypesList() });
`
解决方法
"com.microsoft.word.doc","org.openxmlformats.wordprocessingml.document" 分别用于 Doc 和 Docx,