简体   繁体   中英

Xamarin iOS MusicXML files are greyed out in UIDocumentPickerViewController

I have a Xamarin iOS project written C#. I have implemented a UIDocumentPickerViewController with which can import external Files into my app. PDFs and XMLs work like a charm on iOS 11 with the following code:

// 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);

However .mxl files, that is MusicXML files are shown greyed out in the Files App (DocumentPicker View).

In my Info.plist file I have the following Document Types :

文件类型

and also Imported UTIs :

文件类型

I google for the official UTIs declared by the MusicXML community. On their website I only found a discussion about proposed UTIs stating the following: https://forums.makemusic.com/viewtopic.php?f=12&t=2510

Attached is an XML file (also at the bottom of this email) containing a proposal for UTI declarations for MusicXML, based on the information supplied in Apple's documentation. We've used the following type identifiers: Uncompressed MusicXML: com.musicxml.musicxml Compressed MusicXML: com.musicxml.musicxml-compressed

I've also tried these 2 UTIs ( com.musicxml.musicxml , com.musicxml.musicxml-compressed ) in my Info.plist. Still it didn't work.

Can anyone help me out, please?

EDIT 1: Here you can see the entire Info.plist file:

    <?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>

Did you set up a UTTypeTagSpecification to list the file extensions associated with com.recordare.musicxml ? I'm not seeing this in your screenshots (but I'm also not very familiar with the Xamarin UI)

I can't help with Xamarin, but MusicXML 3.1 added official UTIs. This change is listed in the MusicXML 3.1 Community Group Report at https://www.w3.org/2017/12/musicxml31/ . You can find them documented at https://github.com/w3c/musicxml/blob/gh-pages/schema/container.dtd .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM