Xamarin iOS MusicXML файлы отображаются серым цветом в UIDocumentPickerViewController - PullRequest
0 голосов
/ 30 мая 2018

У меня есть проект Xamarin для 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 у меня есть следующие Типы документов :

Document Types

, а также Импортированные UTI :

Document Types

Я ищу официальные UTI, объявленные сообществом MusicXML.На их веб-сайте я только нашел обсуждение предлагаемых UTI, заявив следующее: https://forums.makemusic.com/viewtopic.php?f=12&t=2510

Прилагается файл XML (также в нижней части этого электронного письма), содержащий предложение для объявлений UTI для MusicXML,на основе информации, представленной в документации Apple.Мы использовали следующие идентификаторы типов: Несжатый MusicXML: com.musicxml.musicxml Сжатый MusicXML: com.musicxml.musicxml-compress

Я также пробовал эти 2 UTI ( com.musicxml.musicxml , com.musicxml.musicxml -ressed ) в моем Info.plist.Тем не менее, это не сработало.

Кто-нибудь может мне помочь, пожалуйста?

РЕДАКТИРОВАТЬ 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>

Ответы [ 2 ]

0 голосов
/ 25 октября 2018

Я не могу помочь с 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.

0 голосов
/ 31 мая 2018

Вы установили UTTypeTagSpecification для отображения расширений файлов, связанных с com.recordare.musicxml?Я не вижу этого на ваших скриншотах (но я также не очень знаком с интерфейсом Xamarin)

...