我有一个iOS项目C#。我实现了一个UIDocumentPickerViewController,它可以将外部文件导入到我的应用程序中。PDF和XML在iOS 11上的工作方式类似于以下代码:
// Allow the Document picker to select a range of document types
var allowedUTIs = new string[] {
UTType.PDF,
UTType.XML,
"com.recordare.musicxml",
"com.recordare.musicxml.uncompressed",
"public.data",
"public.mxl",
"public.content"
};
UIDocumentPickerViewController picker = new UIDocumentPickerViewController(allowedUTIs, UIDocumentPickerMode.Import);但是,.mxl文件,即MusicXML文件在文件应用程序(DocumentPicker视图)中显示为灰色。
在我的Info.plist文件中,我有以下文档类型:

以及导入的UTIs

我在谷歌上搜索MusicXML社区声明的官方UTI。在他们的网站上,我只看到了关于提议的UTI的讨论,说明如下:https://forums.makemusic.com/viewtopic.php?f=12&t=2510
附件是一个XML文件(也在这封电子邮件的底部),其中包含基于苹果文档中提供的信息为MusicXML发布的UTI声明提案。我们使用了以下类型标识符:未压缩MusicXML: com.musicxml.musicxml压缩MusicXML: com.musicxml.musicxml-压缩
我还在我的Info.plist中尝试过这两个UTIs (com.musicxml.musicxml,com.musicxml.musicxml-compressed)。但还是没成功。
有人能帮我一下吗?
编辑1:在这里您可以看到整个Info.plist文件:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>UTImportedTypeDeclarations</key>
<array>
<dict>
<key>UTTypeIdentifier</key>
<string>com.recordare.musicxml.uncompressed</string>
<key>UTTypeReferenceURL</key>
<string>http://www.musicxml.org/</string>
<key>UTTypeDescription</key>
<string>MusicXML</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
<array>
<string>xml</string>
</array>
<key>public.mime-type</key>
<array>
<string>application/vnd.recordare.musicxml+xml</string>
</array>
</dict>
<key>UTTypeConformsTo</key>
<array>
<string>public.data</string>
<string>public.content</string>
</array>
</dict>
<dict>
<key>UTTypeIdentifier</key>
<string>com.recordare.musicxml</string>
<key>UTTypeReferenceURL</key>
<string>http://www.musicxml.org/</string>
<key>UTTypeDescription</key>
<string>MusicXML</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
<array>
<string>mxl</string>
</array>
<key>public.mime-type</key>
<array>
<string>application/vnd.recordare.musicxml</string>
</array>
</dict>
<key>UTTypeConformsTo</key>
<array>
<string>public.data</string>
<string>public.content</string>
</array>
</dict>
<dict>
<key>UTTypeDescription</key>
<string>Midi</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
<array>
<string>mid</string>
</array>
<key>public.mime-type</key>
<array>
<string>audio/midi</string>
</array>
</dict>
<key>UTTypeConformsTo</key>
<array>
<string>public.data</string>
<string>public.content</string>
</array>
<key>UTTypeIdentifier</key>
<string>public.data</string>
</dict>
</array>
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>LSItemContentTypes</key>
<array>
<string>public.xml</string>
</array>
<key>CFBundleTypeName</key>
<string>MusicSheet</string>
</dict>
<dict>
<key>CFBundleTypeIconFiles</key>
<array/>
<key>CFBundleTypeName</key>
<string>MusicSheet</string>
<key>LSItemContentTypes</key>
<array>
<string>com.recordare.musicxml</string>
</array>
</dict>
<dict>
<key>CFBundleTypeIconFiles</key>
<array/>
<key>CFBundleTypeName</key>
<string>MusicSheet</string>
<key>LSItemContentTypes</key>
<array>
<string>com.recordare.musicxml.uncompressed</string>
</array>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>PDF</string>
<key>LSItemContentTypes</key>
<array>
<string>com.adobe.pdf</string>
</array>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>Midi</string>
<key>LSItemContentTypes</key>
<array>
<string>public.data</string>
</array>
</dict>
</array>
<key>MinimumOSVersion</key>
<string>9.3</string>
<key>UIAppFonts</key>
<array>
<string>Fonts/companySymbols.ttf</string>
<string>Fonts/webhostinghub-glyphs.ttf</string>
</array>
<key>UIDeviceFamily</key>
<array>
<integer>1</integer>
<integer>2</integer>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>CFBundleIdentifier</key>
<string>com.company.test1</string>
<key>XSAppIconAssets</key>
<string>Resources/Images.xcassets/AppIcons.appiconset</string>
<key>CFBundleShortVersionString</key>
<string>1.2.0</string>
<key>CFBundleName</key>
<string>Test1</string>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>NSMicrophoneUsageDescription</key>
<string>microphone use</string>
<key>CFBundleDisplayName</key>
<string>Test1</string>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<key>XSLaunchImageAssets</key>
<string>Resources/Images.xcassets/LaunchImage.launchimage</string>
<key>CFBundleVersion</key>
<string>16</string>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>fb-messenger-api</string>
<string>fbauth2</string>
</array>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLName</key>
<string>com.company.test1</string>
<key>CFBundleURLSchemes</key>
<array>
<string>fb899828993298981</string>
<string>com.company.test1</string>
<string>com.googleusercontent.apps.989898989981191-232111s4lsf441cu94</string>
</array>
<key>CFBundleURLTypes</key>
<string>Viewer</string>
</dict>
</array>
</dict>
</plist>发布于 2018-05-31 06:00:38
您是否设置了一个UTTypeTagSpecification来列出与com.recordare.musicxml关联的文件扩展名?我没有在你的截图中看到这个(但我对Xamarin UI也不太熟悉)
发布于 2018-10-25 19:00:40
我无法帮助Xamarin,但是MusicXML 3.1添加了官方的UTI。此更改列在MusicXML 3.1社区组https://www.w3.org/2017/12/musicxml31/报告中。您可以在https://github.com/w3c/musicxml/blob/gh-pages/schema/container.dtd找到它们的文档。
https://stackoverflow.com/questions/50601720
复制相似问题