0

我有一个用 C# 编写的 Xamarin iOS 项目。我已经实现了一个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 文件中,我有以下文档类型

文件类型

以及进口的尿路感染

文件类型

我在 Google 上搜索了 MusicXML 社区声明的官方 UTI。在他们的网站上,我只发现了关于提议的 UTI 的讨论,说明如下: https ://forums.makemusic.com/viewtopic.php?f=12&t=2510

附件是一个 XML 文件(也在此电子邮件的底部),其中包含基于 Apple 文档中提供的信息的 MusicXML 的 UTI 声明提案。我们使用了以下类型标识符: 未压缩的 MusicXML:com.musicxml.musicxml 压缩的 MusicXML:com.musicxml.musicxml-compressed

我还在我的 Info.plist 中尝试了这 2 个 UTI(com.musicxml.musicxmlcom.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>
4

2 回答 2

0

我对 Xamarin 无能为力,但 MusicXML 3.1 添加了官方 UTI。此更改列在https://www.w3.org/2017/12/musicxml31/上的 MusicXML 3.1 社区组报告中。您可以在https://github.com/w3c/musicxml/blob/gh-pages/schema/container.dtd找到它们的文档。

于 2018-10-25T19:00:40.550 回答
0

您是否设置了UTTypeTagSpecification列出与 关联的文件扩展名com.recordare.musicxml?我在您的屏幕截图中没有看到这一点(但我对 Xamarin UI 也不是很熟悉)

于 2018-05-31T06:00:38.160 回答